Using an AI coding assistant?
For AI-driven installation, use this prompt:
Step 0. Configure APNs in OneSignal (required to deliver push)
You can install and initialize the OneSignal iOS SDK without completing this step. However, push notifications will not deliver until APNs credentials are configured in your OneSignal app.If your company already has a OneSignal account, ask to be invited as an admin role to configure the app. Otherwise, sign up for a free account to get started.
Steps to configure your OneSignal app.
Steps to configure your OneSignal app.
These steps connect your OneSignal app to Apple Push Notification service (APNs). You only need to do this once per app.
- Login to https://onesignal.com and create or select your App.
- Navigate to Settings > Push & In-App to Set up Push & In-App.
- Select Apple iOS (APNs) and Continue through the setup wizard.
- Input your p8 Auth Key (Recommended) or p12 Certificate details.
- Continue through the setup wizard to get your App ID. This will be used to initialize the SDK.
For full setup instructions, see our Mobile push setup guide.
Setup contract & requirements
This section summarizes the tools, versions, and assumptions used throughout the guide.- SDK version:
5.4.0+(latest: check releases) - SDK repo:
https://github.com/OneSignal/OneSignal-XCFramework - Xcode: 16.0+
- iOS: 12.0+ minimum, 16.2+ recommended
- Simulator: iOS 16.2+ required for push testing
- App target packages:
OneSignalFramework(required),OneSignalInAppMessages(recommended),OneSignalLocation(optional) - Notification Service Extension (NSE) target name:
OneSignalNotificationServiceExtension - Notification Service Extension (NSE) target package:
OneSignalExtension - App Group format:
group.{bundle_id}.onesignal - App ID format: 36-character UUID (example:
12345678-1234-1234-1234-123456789012) — find at OneSignal Dashboard > Settings > Keys & IDs - Initialize:
OneSignal.initialize("YOUR_APP_ID", withLaunchOptions: launchOptions) - Requires NSE + App Group: images, confirmed delivery, badges
- Confirmed Delivery: Requires an eligible plan (not available on free plans)
- Recommended: Assign External ID via
OneSignal.login("user_id")to unify users across devices
iOS setup steps
By the end of the steps below, you will have:- The OneSignal SDK installed and initialized in your iOS app
- Push notification permissions prompting correctly on a real device
- A test push and in-app message successfully delivered
If you skipped Step 0 (Configuring APNs in OneSignal), you can still complete the Xcode setup below. Complete Step 0 before you test or send push notifications.
Step 1. Enable Push Notifications and Background Modes
- Open your
.xcodeprojin Xcode (or.xcworkspaceif using CocoaPods) - Select app target > Signing & Capabilities
- Click + Capability > add Push Notifications
- Click + Capability > add Background Modes
- Enable Remote notifications checkbox

Step 2. Add a Notification Service Extension (NSE)
The NSE enables rich notifications (images) and Confirmed Delivery analytics. Create the target:- File > New > Target…
- Select Notification Service Extension > Next
- Product name:
OneSignalNotificationServiceExtension - Click Finish > click Don’t Activate when prompted



- Select OneSignalNotificationServiceExtension target > General
- Set Minimum Deployments to match your app target


- Navigate to OneSignalNotificationServiceExtension/NotificationService.swift
- Replace the contents with the code below:
Don’t panic! Build errors will resolve after installing the SDK.

Step 3. Create an App Group
App Groups enable data sharing between your app and the NSE. Required for confirmed delivery, badges, and images.- Select app target > Signing & Capabilities
- Click + Capability > add App Groups
- Click + and enter:
group.{BUNDLE_IDENTIFIER}.onesignal- Find your Bundle Identifier at app target > General, or run:
- Find your Bundle Identifier at app target > General, or run:
- Select OneSignalNotificationServiceExtension target > Signing & Capabilities
- Click + Capability > add App Groups
- Select the same App Group ID you just created
If you need OneSignal to use an existing App Group instead of creating a new one, add this to
Info.plist for both your app target and NSE target.
Replace group.your-existing-group-id with your existing App Group ID.


Step 4. Install the OneSignal SDK
Swift Package Manager (recommended):- Select Your project file > Package Dependencies > +
- Enter:
https://github.com/OneSignal/OneSignal-XCFramework - Click Add Package
- Assign packages:
| Package | Target | Required |
|---|---|---|
OneSignalExtension | OneSignalNotificationServiceExtension | ✅ |
OneSignalFramework | App | ✅ |
OneSignalInAppMessages | App | Recommended |
OneSignalLocation | App | Optional |


Where to verify in Xcode: select the target → Build Phases → confirm the correct OneSignal products appear under “Link Binary With Libraries”.
CocoaPods alternative
CocoaPods alternative
Requires CocoaPods 1.16.2+. Add to Run
Podfile:Podfile
pod repo update && pod install, then open .xcworkspace (not .xcodeproj).Common error: ArgumentError - [Xcodeproj] Unable to find compatibility version string for object version 70.CocoaPods relies on the xcodeproj Ruby gem to read your Xcode project files. As of now, the latest xcodeproj release does not recognize object version 70, which was introduced by Xcode 16. So when CocoaPods tries to open your .xcodeproj file, it crashes with this error.- Close Xcode.
- Navigate to your project’s
ios/<your-app>.xcodeproj/project.pbxprojfile. - Change this line:
objectVersion = 70; - Replace it with:
objectVersion = 55; - Save, close, and rerun
cd ios pod install cd ..
Verify that the build succeeds without “No such module” errors.
Step 5. Initialize OneSignal
SwiftUI:Swift
UIKit (Storyboard) alternative
UIKit (Storyboard) alternative
Verify the app builds, runs, and shows the push permission prompt.
Step 6. Test the integration
Verify subscription:- Launch app on device
- Check Dashboard > Audience > Subscriptions — status shows “Never Subscribed”
- Accept the permission prompt
- Refresh dashboard — status changes to “Subscribed”



You have successfully created a mobile Subscription.
Mobile subscriptions are created when users first open your app on a device or if they uninstall and reinstall your app on the same device.
Create test Subscription and segment
- Click ⋮ next to the Subscription > Add to Test Subscriptions > name it
- Go to Audience > Segments > New Segment
- Name:
Test Users, add filter Test Users > Create Segment


You have successfully created a segment of test users.
We can now test sending messages to this individual device and groups of test users.
Send test push via API
- Navigate to Settings > Keys & IDs.
- In the provided code, replace
YOUR_APP_API_KEYandYOUR_APP_IDin the code below with your actual keys. This code uses theTest Userssegment we created earlier.


Verify the test device received a notification with:
- An image.
- Dashboard > Delivery > Sent Messages shows “Confirmed” status (unavailable on free plans).
Test in-app messages
- Close app for 30+ seconds
- Dashboard > Messages > In-App > New In-App > select Welcome template
- Audience: Test Users segment
- Trigger: On app open
- Schedule: Every time trigger conditions are satisfied
- Click Make Message Live
- Open app




Verify the test device received an in-app message. See the In-app messages setup guide for more details.
You have successfully setup the OneSignal SDK and learned important concepts like:
- Gathering Subscriptions, setting Test subscriptions, and creating Segments.
- Sending Push with images and Confirmed Delivery using Segments and our Create message API.
- Sending In-app messages.
Common Errors & Fixes
| Error / Symptom | Cause | Fix |
|---|---|---|
No such module 'OneSignalFramework' | Package not added to app target | Add OneSignalFramework via File > Add Package Dependencies. Clean and build the project. |
No such module 'OneSignalExtension' | Package not added to NSE | Add OneSignalExtension to OneSignalNotificationServiceExtension target. Clean and build the project. |
| Push received but no image | NSE not running | Verify NSE deployment target matches app; confirm code is updated |
| No confirmed delivery stat | App Group mismatch | App Group ID must be identical in both targets |
| Badges not updating | App Group missing | Add App Groups capability to both targets |
| In-app not showing | Session not started or missing OneSignalInAppMessages framework | Check the framework is added, then close app 30+ seconds before reopening |
| Can’t diagnose issue | Not enough log info | Add OneSignal.Debug.setLogLevel(.LL_VERBOSE) before initialize, then reproduce the issue to get a log |
User management
Previously, we demonstrated how to create mobile Subscriptions. Now we’ll expand to identifying Users across all their Subscriptions (including push, email, and SMS) using the OneSignal SDK.Assign External ID (recommended)
Use an External ID to identify users consistently across devices, email addresses, and phone numbers using your backend’s user identifier. This ensures your messaging stays unified across channels and 3rd party systems. See our Mobile SDK reference for more details and Objective-C code examples.OneSignal generates unique read-only IDs for Subscriptions (Subscription ID) and Users (OneSignal ID).Setting the External ID via our SDK is highly recommended to identify users across all their subscriptions, regardless of how they are created.Learn more about the
login method in the SDK reference guide.Add Tags & Custom Events
Tags and Custom Events are both ways to add data to your users. Tags arekey-value strings or numbers and are generally associated with user properties (like username, role, or status) while Custom Events have a JSON format and are usually associated with actions (like new_purchase, abandoned_cart, and associated properties). Both can be used to power advanced Message Personalization and Journeys. See our Mobile SDK reference for more details and Objective-C code examples.
More details on how to use Tags and Custom Events in the Tags and Custom Events guides.
Add email and/or SMS subscriptions
You can reach users through email and SMS channels in addition to push notifications. If the email address and/or phone number already exist in the OneSignal app, the SDK will add it to the existing user — it will not create duplicates. See our Mobile SDK reference for more details and Objective-C code examples.
Best practices for multi-channel communication
- Obtain explicit consent before adding email or SMS subscriptions.
- Explain the benefits of each communication channel to users.
- Provide channel preferences so users can select which channels they prefer.
Privacy & user consent
To control when OneSignal collects user data, use the SDK’s consent gating methods. See our Mobile SDK reference for more details and Objective-C code examples.Prompt for push permissions
Instead of callingrequestPermission() immediately on app open, take a more strategic approach. Use an in-app message to explain the value of push notifications before requesting permission.
For best practices and implementation details, see our Prompt for push permissions guide.
Listen to push, user, and in-app events
Use SDK listeners to react to user actions and state changes. Add these in your AppDelegate afterOneSignal.initialize().
Push notification events
Example shows how to use the push click listener. Other push notification events like the foreground lifecycle listener to control how notifications behave in foreground are available in the Mobile SDK Reference.User state changes
Example shows how to use push subscription observer. Other user state events like the user state observer and notification permission observer are available in the Mobile SDK Reference.In-app message events
Additional in-app message methods are available in the Mobile SDK Reference.Advanced setup & capabilities
- Deep Linking — Navigate users to specific screens from notifications
- Action Buttons — Add interactive buttons to notifications
- Live Activities — iOS Live Activities support
- Service Extensions — Advanced notification customization
- Identity Verification — Secure user identification
- Location Tracking — Location-based targeting
- Integrations — Connect with analytics and data platforms
- Multi-language Messaging — Localized notifications
Need help?Chat with our Support team or email
[email protected]Please include:- Details of the issue you’re experiencing and steps to reproduce if available
- Your OneSignal App ID
- The External ID or Subscription ID if applicable
- The URL to the message you tested in the OneSignal Dashboard if applicable
- Any relevant logs or error messages