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