Ios 为什么我会收到launchOption dictionary nil的Apple推送通知?
我正在从服务器发送推送通知,如果应用程序在后台运行,通知到达并点击它调用didReceiveEmoteNotification() 但是当我关闭我的应用程序时(在双击home按钮后刷起应用程序,通知会到达,但点击通知只会将屏幕指向AppHome。我已经在didFinishLaunchingWithOptions:launchOptions()中编写了代码,如下所示Ios 为什么我会收到launchOption dictionary nil的Apple推送通知?,ios,objective-c,apple-push-notifications,Ios,Objective C,Apple Push Notifications,我正在从服务器发送推送通知,如果应用程序在后台运行,通知到达并点击它调用didReceiveEmoteNotification() 但是当我关闭我的应用程序时(在双击home按钮后刷起应用程序,通知会到达,但点击通知只会将屏幕指向AppHome。我已经在didFinishLaunchingWithOptions:launchOptions()中编写了代码,如下所示 if (launchOptions != nil) { NSDictionary* dictionary
if (launchOptions != nil)
{
NSDictionary* dictionary = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];
if (dictionary != nil)
{
NSLog(@"Launched from push notification: %@", dictionary);
NSString *strVendId=[dictionary valueForKeyPath:@"payload.vendor_id"];
UIStoryboard *mainstoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UINavigationController *navController = (UINavigationController *)self.window.rootViewController;
VenderDetailController *vDetail=[mainstoryboard instantiateViewControllerWithIdentifier:@"venDetail"];
vDetail.strVendorId=strVendId;
[navController pushViewController:vDetail animated:YES];
}
}
当应用程序被终止时,我无法调试此应用程序。可能我无法确定是否得到了nil字典。我甚至尝试删除launchOption nil条件,但仍然没有帮助
我正在使用objective C,这个问题快把我逼疯了。试试这个
NSDictionary *localNotif = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
试试这个
NSDictionary *localNotif = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
首先检查设备日志中的日志,确认字典是否为零。要在应用程序终止时检查日志,请转到窗口->设备,然后选择您的设备,然后点击左下角的箭头图标,如下图所示。即使您没有从Xcod运行应用程序,您也可以看到所有日志e:
记录您正在获取的词典,这将有助于调试。首先检查设备日志中的日志,确认词典是否为零。要在应用程序终止时检查日志,请转到窗口->设备,然后选择您的设备,然后点击左下角的箭头图标,如下图所示。您将成为即使您不是从Xcode运行应用程序,也可以查看所有日志:
记录您正在获取的词典,这将有助于调试。您可以使用Chandan005的解决方案查看调试控制台,或者使用UIAlertView inside
didFinishLaunchingWithOptions:launchOptions
显示词典的内容,以检查您是否获得正确的远程通知负载。可以使用Chandan005的解决方案查看调试控制台,也可以使用UIAlertView insidedidFinishLaunchingWithOptions:launchOptions
显示字典内容,以检查是否获得正确的远程通知负载。是否可以记录launchOptions并告诉值show如果我杀死应用程序,xcode项目停止。那么我如何记录设备中的内容?您是否可以记录启动选项并告诉值Show如果我关闭应用程序,xcode项目停止,我可以实现这一点。那么我如何记录设备中的内容?