有人遇到过推送的通知测试版可以在通知栏点开到具体页面,但是 appstore 版本点开就停在首页的问题吗? 我的跳转代码是这样的
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
if (application.applicationState == UIApplicationStateActive) {
[self gotoUrl:userInfo];
}else{
[self showPushArticle:userInfo];
}
completionHandler(UIBackgroundFetchResultNewData);
}
showPushArticle 函数
- (void)showPushArticle:(NSDictionary *)userInfo
{
if (userInfo == NULL) {
return;
}
NSDictionary *article = [userInfo objectForKey:@"ext"];
if(article)
{
NSString *url = [article objectForKey:@"l"];
if(![url hasPrefix:@"https://"]){
return;
}
PTWebViewController *viewcontroller = [[PTWebViewController alloc] init];
viewcontroller.webURL = url;
[viewcontroller setNavigationTitle:@"推送新闻"];
[self.drawerController.centerNavigationController pushViewController:viewcontroller animated:YES];
}
}
push 的 json 格式是:
{"aps":{"alert":"title","badge":1,"sound": "default"},"ext":{"l":"https://example.com"}}
不知道哪位遇到过同样的问题,麻烦指教一下