iOS code examples
With Pushwoosh samples for iOS, you can explore Pushwoosh functionality without integrating the SDK into your project, or review how the Pushwoosh SDK is implemented in our example projects
Prerequisites
Section titled “Prerequisites”Before using the examples, ensure you have the following:
Pushwoosh sample application
Section titled “Pushwoosh sample application”This project is a basic iOS application with the Pushwoosh SDK integrated, showcasing key features such as:
- Receiving push notifications.
- Tracking push notification delivery.
- Managing user tags.
- Sending events
- User registration
Use the sample app as a learning tool or a foundation for your development.
1. Download the sample app
Section titled “1. Download the sample app”Clone the repository:
git clone https://github.com/Pushwoosh/pushwoosh-ios-sample.git
2. Configure the project
Section titled “2. Configure the project”Open the project in Xcode.
Add
https://github.com/Pushwoosh/Pushwoosh-XCFramework
as Swift Package Dependency.Set the bundle identifier for the main target (PushwooshSampleApp) to match your Pushwoosh project (e.g.,
com.pushwoosh.PushwooshSampleApp
).Use the same bundle identifier for the NotificationService target, appending
.NotificationService
(e.g.,com.pushwoosh.PushwooshSampleApp.NotificationService
).In
Info.plist
, set the:Pushwoosh_APPID
key to the Pushwoosh Application CodePushwoosh_API_TOKEN
key to the Pushwoosh Device API Token
Important: Be sure to give the token access to the right app in your Pushwoosh Control Panel. Learn more
3. Run the project
Section titled “3. Run the project”- Build and run the project.
- Navigate to the Settings tab in the app.
- Tap the Register for Pushes button.
- Grant permission for push notifications. The device will be registered with Pushwoosh.
Pushwoosh quickstart applications
Section titled “Pushwoosh quickstart applications”The quickstart collection includes individual projects, each showcasing specific SDK features. Use these as references or starting points for your app
1. Download the quickstart applications
Section titled “1. Download the quickstart applications”Clone the example project from GitHub:
git clone https://github.com/Pushwoosh/pushwoosh-quickstart-ios.git
2. Explore the projects
Section titled “2. Explore the projects”Each folder contains a project tailored to a specific feature:
- Basic Integration
- Badges
- Custom Data Examples
- Customizing
- Delivery tracking
- Inbox Project
- Interactive Push
- Provisional Push Project
- Rich Notifications Project
- VoIP Pushes Project
3. Configure and run
Section titled “3. Configure and run”- Open the project in Xcode.
- Set the bundle identifier to match your Pushwoosh project.
- Copy the Application Code from the Pushwoosh Dashboard.
- In
Info.plist
, set thePushwoosh_APPID
key to the Application Code - Build and run the project.
- Use the Pushwoosh Control Panel to send a push notification and see it in action.