Skip to content

iOS message delivery tracking

There is an API method in Pushwoosh that tracks the delivery of push notifications. iOS apps do not support this method out of the box as push notifications in iOS are handled by the OS, not by Pushwoosh SDK. However, you can implement delivery tracking by adding the Pushwoosh Notification Service Extension for push delivery tracking to your project. Here you’ll find the steps to implement Message Delivery Tracking for iOS apps.

  1. In Xcode, Select File > New > Target…

  2. Select Notification Service Extension and press Next.

  1. Enter the product name and press Finish.
  1. Press Cancel on the Activate scheme prompt.

By canceling, you are keeping Xcode debugging your app, instead of the extension you just created. If you activated it by accident, you can switch back to debug your app within Xcode.

Dependencies for the Notification Service Extension (CocoaPods only)

Section titled “Dependencies for the Notification Service Extension (CocoaPods only)”

Note: If you’re using Swift Package Manager to manage dependencies, you can skip this step, as the dependencies are added automatically.

Open your Podfile and add the dependency for the target:

Podfile
target 'NotificationServiceExtension' do
use_frameworks!
pod 'PushwooshXCFramework'
end

Run the following commands in the terminal to install the dependencies:

Terminal window
rm -rf Podfile.lock
pod deintegrate
pod setup
pod repo update
pod install

Add code for tracking message delivery events

Section titled “Add code for tracking message delivery events”
  1. Add the following code to your NotificationService.m file:
import UserNotifications
import PushwooshFramework
class NotificationService: UNNotificationServiceExtension {
var contentHandler: ((UNNotificationContent) -> Void)?
var bestAttemptContent: UNMutableNotificationContent?
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
PWNotificationExtensionManager.shared().handle(request, contentHandler: contentHandler)
}
}
  1. Add Pushwoosh_APPID to your Notification Service Extension info.plist.
<key>Pushwoosh_APPID</key>
<string>XXXXX-XXXXX</string>

Your feedback helps us create a better experience, so we would love to hear from you if you have any issues during the SDK integration process. If you face any difficulties, please do not hesitate to share your thoughts with us via this form.