
我尝试过的最新方法如下:
我包含了我想要显示的VIEwController.然后我将此代码放在dIDReceiveRemoteNotification方法中.
CarFinderVIEwController *pvc = [[CarFinderVIEwController alloc] init]; // [self.window.rootVIEwController presentVIEwController:pvc animated:YES completion:nil]; [(UINavigationController *)self.window.rootVIEwController pushVIEwController:pvc animated:NO];
这没用.我认为我可能遇到的问题是我的初始视图不像许多示例所示的导航控制器.
这是我的故事板的图片>我想发送给用户的VC是汽车发现者(右下角)
有人可以向我解释我可能做错了什么吗?
解决方法 收到远程通知时,您可以使用基本上postNotification对于像你这样的dIDReceiveRemoteNotification帖子通知中的exmaple
[[NSNotificationCenter defaultCenter] postNotificationname:@"pushNotification" object:nil userInfo:userInfo];
现在在你的FirstVIEwController中你可以像这样为这个通知注册FirstVIEwController
[[NSNotificationCenter defaultCenter] addobserver:self selector:@selector(pushNotificationReceived) name:@"pushNotification" object:nil];
并在你的方法
-(voID)pushNotificationReceived{CarFinderVIEwController *pvc = [[CarFinderVIEwController alloc] init];[self presentVIEwController:pvc animated:YES completion:nil];} 不要忘记在dealloc方法中删除观察者的通知
-(voID)dealloc {[[NSNotificationCenter defaultCenter] removeObserver:self];} 总结 以上是内存溢出为你收集整理的iphone – 从didReceiveRemoteNotification打开视图全部内容,希望文章能够帮你解决iphone – 从didReceiveRemoteNotification打开视图所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)