Untitled

mail@pastecode.io avatar
unknown
objectivec
a year ago
776 B
5
Indexable
Never
// 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;
    }
}