If you are not seeing statistics for push notification sends and opens for your iOS application, the issue is most likely related to an incorrect configuration of the Notification Service Extension (NSE). The NSE is responsible for processing incoming notifications and tracking these statistics before the notification is displayed to the user.
Follow these steps to troubleshoot and resolve the issue:
1. Verify your NotificationService implementation
Your NotificationService.swift file should contain only the code required to hand the notification request to the Pushwoosh SDK. Any additional custom code can interfere with statistics tracking.
Pushwoosh iOS SDK 7.1.0 and newer (recommended): simply subclass PushwooshNotificationServiceExtension. An empty subclass is enough — the SDK sends the delivery event, sets the badge, downloads media attachments and handles the serviceExtensionTimeWillExpire fallback for you.
import UserNotifications
import PushwooshFramework
class NotificationService: PushwooshNotificationServiceExtension {}
Legacy integration: the older PWNotificationExtensionManager API still works but is deprecated. Only use it if you cannot move to the base class yet:
import UserNotifications
import PushwooshFramework
class NotificationService: UNNotificationServiceExtension {
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
PWNotificationExtensionManager.shared().handle(request, contentHandler: contentHandler)
}
}
2. Check your target configuration
Pushwoosh_APPID. Since SDK 7.1.0 the extension inherits Pushwoosh_APPID (and the other Pushwoosh_* keys) from the host app's Info.plist, so you no longer need to duplicate it in the extension. Add it to the extension's Info.plist only if you want to override the host value:
<key>Pushwoosh_APPID</key>
<string>XXXXX-XXXXX</string>
On SDK versions earlier than 7.1.0 the extension does not inherit configuration from the host app, so Pushwoosh_APPID must be present in the extension's Info.plist as well.
App Groups. Enable the App Groups capability on both the main app target and the NSE target under “Signing & Capabilities”, using the same group identifier (e.g. group.com.example.appname). The shared container is required to sync the badge count and reverse-proxy settings. Since 7.1.0 the extension also inherits PW_APP_GROUPS_NAME from the host app.
Dependencies. With CocoaPods, add pod 'PushwooshXCFramework' to the extension target. With Swift Package Manager the dependency is added automatically.
3. Re-add the Notification Service Extension
If everything above checks out and statistics are still not collected, there may be a project configuration conflict. Remove the NSE target completely and add it again, following the iOS message delivery tracking guide.
Comments
0 comments
Please sign in to leave a comment.