iPhone的推出期权 [英] iphone Launch Options

查看:133
本文介绍了iPhone的推出期权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不是一个推送通知后获得任何启动选项;继承人的code我有,但NSLogs非似乎在调试要打印的区域。

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(@"//////////////////////////");

}

当我打开应用程序(通过推送通知pressing的观点)转到didReceiveRemoteNotification脚本,林不知道如果多数民众赞成意味着要发生..

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..

感谢您的阅读。

推荐答案

您的应用程序接收通过多条路径推送通知,具体取决于在收到时您的应用程序的状态。

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

如果您的应用程序未启动(甚至没有暂停背景),在 launchOptions 将包含该通知的有效载荷(键 UIApplicationLaunchOptionsRemoteNotificationKey )。

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

如果它已在运行或暂停的背景下,应用程序将通过收到通知应用程序:didReceiveRemoteNotification:在你的应用程序委托

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

这个过程是本地通知(UIApplicationLaunchOptionsLocalNotificationKey在应用中:didFinishLaunchingWithOptions:和应用程序:didReceiveLocalNotification:)相同

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

这篇关于iPhone的推出期权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆