2012-08-07 252 views
0

如果应用程序不在后台,则会发送推送通知。点击启动按钮不会显示推送通知,它只会打开应用程序,打开推送通知时,我们必须再次点击通知任务栏中的推送通知。任何启动的方式,我们也可以显示通知?如何处理应用程序未在后台运行时的推送通知

+0

已解决。请参阅:http://stackoverflow.com/questions/4782352/how-can-i-handle-push-notification-when-my-app-is-not-running – Inder 2012-08-08 11:25:15

回答

1

已解决。回答是:

(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  

NSDictionary *tmpDic = [launchOptions objectForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"]; 

//if tmpDic is not nil, then your app is launched due to an APNs push, therefore check this NSDictionary for further information 
if (tmpDic != nil) { 
    NSLog(@" - launch options dict has something "); 
    NSLog(@" - badge number is %@ ", [[tmpDic objectForKey:@"aps"] objectForKey:@"badge"]); 
    NSLog(@" - "); 
} 
相关问题