Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iphone Launch Options

im not getting any launch options after a push notification; heres the code i have but non of the NSLogs seem to print in the debug area.

UILocalNotification *localNotif =
[launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];

if (localNotif) {
    NSString *itemName = [localNotif.userInfo objectForKey:@"aps"];
    NSLog(@"Custom: %@", itemName);
} else {
    NSLog(@"//////////////////////////");

}

when i open the app (via pressing view on the push notification) it goes to the didReceiveRemoteNotification script, im not sure if thats meant to happen..

thanks for reading.

like image 634
user633268 Avatar asked Mar 28 '11 08:03

user633268


People also ask

How do I launch on my iPhone?

Press and hold the Home button until you see the Siri screen. Tell Siri "Launch [app name]". Your app should launch immediately.


1 Answers

Your application receives push notifications through multiple paths, depending on the state of your app when it is received.

If your app is not launched (not even suspended in background), the launchOptions will contain the notification payload (key UIApplicationLaunchOptionsRemoteNotificationKey).

If it is already running or suspended in background, the app will receive the notifications via application:didReceiveRemoteNotification: in your application delegate.

The process is the same for local notifications (UIApplicationLaunchOptionsLocalNotificationKey in application:didFinishLaunchingWithOptions: and application:didReceiveLocalNotification:)

like image 122
Jilouc Avatar answered Sep 23 '22 01:09

Jilouc