0
我想在用户单击远程通知时打开移动浏览器。当用户点击推送通知时打开Safari浏览器
1)这是行吗,还是会导致我的应用程序被拒绝?
2)如果允许,我该如何在应用程序未打开时执行此操作?我目前使用以下代码:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
[[NSUserDefaults standardUserDefaults] setObject:@"received link here" forKey:@"SNL_APNs_LINK"];
UIApplicationState state = [application applicationState];
if (state == UIApplicationStateActive)
{
//app is running
//only for testing, will add an alert to inform user when published
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[[NSUserDefaults standardUserDefaults] valueForKey:@"SNL_APNs_LINK"]]];
}
else if (state == UIApplicationStateInactive)
{
//app in inactive state
//how do I redirect the user to browser when the app is not open?
}
}
为什么不尝试打开推送通知作为模态视图控制器与全屏幕'UIWebView'在你自己的应用程序内而不是重定向到Safari? – Eugene