【发布时间】:2014-11-04 20:11:58
【问题描述】:
我试图弄清楚如何检查推送通知的有效负载,以确定当用户从通知中打开应用程序时打开哪个视图。例如,如果通知显示“x:test”,则在点击通知时会打开视图 x,如果通知显示“y:test”,则会打开视图。
编辑:我想我应该澄清我不确定的部分。
我在 didFinishLaunchingWithOptions 中有这个:
UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (notification)
{
// check payload then load appropriate view controller
}
如何检查特定文本的有效负载以确定要加载的适当视图控制器?
【问题讨论】:
-
你搜索过吗?在 AppDelegate.m 中的应用程序 didFinishLaunchingWithOptions 方法中,您阅读远程通知,并根据 if 语句“说”的内容打开正确的视图。
-
developer.apple.com/library/ios/documentation/… 看来您正在尝试做类似于stackoverflow.com/questions/8685333/… 中的解决方案的事情
标签: ios push-notification apple-push-notifications payload