如果应用程序不在后台,则推送通知来了。单击启动按钮不会显示推送通知,它只会打开应用程序,要打开该推送通知,我们必须再次点击通知托盘中的推送通知。任何方式与启动我们也可以显示通知?
问问题
573 次
1 回答
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(@" - ");
}
于 2012-08-08T11:26:25.003 回答