Untitled
unknown
objectivec
3 years ago
776 B
13
Indexable
// En appdelegate.h
@property (nonatomic, strong) NSDictionary *remoteNotificationAtLaunch;
// 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 != nil) {
NSDictionary *notificationAtLaunch = appDelegate.remoteNotificationAtLaunch;
// Do something with the notification
// More code
// Then set the object to null value
appDelegate.remoteNotificationAtLaunch = nil;
}
}Editor is loading...