4.2. iOS: Click Counts for Mobile Push
Before you begin, make sure you’ve completed these steps:
You've successfully completed the "Click Counts for Mobile Push Notifications on iOS" step, if:The push notification has been sent and is displayed on your phone. When clicked, its status in the system is changed to "click received".
To verify that clicks are being registered, follow this guide.
In the AppDelegate, find (or create if absent) the userNotificationCenter.didReceive method and callMindbox.shared.pushClicked(response: response).
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
// ...
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
// ...
Mindbox.shared.pushClicked(response: response)
// ...
completionHandler()
}
}// MINDBOX INTEGRATION
@import Mindbox;
@import MindboxSdk;
@implementation AppDelegate
...
// MINDBOX INTEGRATION
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
[[Mindbox shared] pushClickedWithResponse:response];
completionHandler();
}
...
@endCheck if the step was completed successfully.
Updated 9 months ago

