Skip to main content

Automatic (the default)

Like the OneSignal, Firebase and Braze SDKs, ours hooks the system callbacks when you call configure, so none of this needs app code:
  • Device tokens. Your app delegate’s token callback is hooked, and the token is registered with your bundle id and the right APNs environment (read from the build’s provisioning profile, so Xcode and TestFlight builds are told apart correctly). The SDK also re-registers on every launch once permission is granted, so tokens never go stale.
  • Taps and dismissals. Your UNUserNotificationCenterDelegate’s didReceive is hooked (or one is provided if you never set a delegate). Your own implementation is always called, so your deep-link routing keeps working. Our notifications are reported as $notification_tapped or $notification_dismissed.
  • The dismiss category. iOS only reports swipe-to-dismiss for notification categories registered with .customDismissAction. The SDK adds its category to the ones you already registered, and never replaces them.
Asking the user for permission is still up to you:

Tap destinations

A flow’s message can carry a deep link. When the user taps, iOS hands the notification to your delegate as usual, with the link under the deep_link key for your router to open:
If a message has no deep link, a tap simply opens the app.

Custom data

A message’s custom data arrives as top-level keys in the notification’s userInfo, next to deep_link. Values set in a flow are always strings:
To act on it while the app is open, read the same keys in your delegate’s willPresent.

Manual integration

Turn the hooks off if another SDK’s swizzling conflicts with ours, or your delegate setup needs to be explicit:
Then forward the two callbacks yourself:
handleNotificationResponse never calls the completion handler for you, and returns whether the notification came from PushNotifAI. If your app sets its whole category list with setNotificationCategories (which replaces whatever was there), also set automaticallyRegistersNotificationCategory: false and include ours: