Untitled
unknown
objectivec
2 years ago
1.1 kB
11
Indexable
// En AppDelegate.m #import <Indigitall/Indigitall.h> (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler { [Indigitall handleWithResponse:response completionHandler:^(IndigitallPush *push, IndigitallPushAction action) { self.remoteNotificationAtLaunch = @{@"data": push.data}; // More code completionHandler(); }]; } // En el ViewController principal (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [self checkForNotificationAtLaunch]; } (void)checkForNotificationAtLaunch { // Comprueba que tenga el objeto tenga valor en el AppDelegate AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; if (appDelegate.remoteNotificationAtLaunch) { // Do something with the notification // More code // Then set the object to null value appDelegate.remoteNotificationAtLaunch = nil; } }
Editor is loading...