Becoming UNUserNotificationCenterDelegate for Appoxee Standalone
Becoming UNUserNotificationCenterDelegate requires forwarding data to Appoxee.
Notification Delegate:
If you choose to become UNUserNotificationCenterDelegate, it will require you to forward its delegate methods to Appoxee:
Note that after becoming UNUserNotificationCenterDelegate, Appoxee SDK will only take over after application launch from a killed state.
Forwarding calls - ObjC
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler __IOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0) __TVOS_PROHIBITED
{
[[Appoxee shared] userNotificationCenter:center didReceiveNotificationResponse:response withAppoxeeCompletionHandler:^{
// When the completion handler is called, this means that Appoxee completed it's execution.
// Call the completion handler.
completionHandler();
}];
}
Forwarding calls - Swift
@available(iOS 10.0, *)
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
Appoxee.shared()?.userNotificationCenter(center, didReceive: response, withAppoxeeCompletionHandler: {
// When the completion handler is called, this means that Appoxee completed it's execution.
// Call the completion handler.
completionHandler()
})
}
And to control the display of notifications in the foreground by yourself.
Foreground notifications - ObjC
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
{
// Choose to display, or not display notifications on foreground.
completionHandler(UNNotificationPresentationOptionNone);
}