Prerequisites
- A push provider configured under Settings → Integrations with the APNs
.p8key, key ID, and team ID. Read Set up push notifications for the project-side setup. - The
Push Notificationscapability enabled on your app target in Xcode. - (For silent in-app refresh) the
Background Modescapability withRemote notificationsenabled.
Request permission and register
UIApplication.shared.registerForRemoteNotifications() triggers APNs registration. You ask for user permission via UNUserNotificationCenter first.
requestPushPermission() from a sensible moment (after onboarding, after the first useful action). Apple’s Human Interface Guidelines discourage prompting at app launch.
Hand the device token to Spotzee
Implementapplication(_:didRegisterForRemoteNotificationsWithDeviceToken:) and pass the raw Data directly into Spotzee.shared.register(token:). The SDK converts it to the hex-encoded string Spotzee’s APNs sender expects.
register also reports device characteristics (model, OS version, app version, build) on the same call, which feeds segment rules like “Devices on iOS 18 or later”.
If APNs registration fails, you can still register the device’s characteristics without a push token. The user becomes addressable for non-push channels and segment rules; pass nil:
identify, or you must let the SDK use its persisted anonymous ID, before register succeeds.
Route incoming payloads through the SDK
Every push payload that opens or wakes the app should pass throughSpotzee.shared.handle(_:userInfo:). The SDK does two things with it:
- Silent refresh. A push with
aps.content-available = 1and no UI triggers an in-app notification fetch viashowLatestNotification. - Deeplink unwrap. A push carrying a
urlfield opens the URL through the SDK’s deeplink handler so click tracking is registered before the app navigates.
UNUserNotificationCenter. Implement the standard delegate methods alongside the SDK call so your app handles taps the way you want:
Test a push
Configure a test user in Settings → Integrations → Push under the provider and trigger a test send. Read Test a push for the project-side flow.What lives where
Next steps
In-app notifications and deeplinks
Render in-app modals and unwrap Universal Links.
Configure push providers
Set up APN credentials before the SDK can deliver push.