像这样的通知,我的应用程序寄存器:
My app registers for the notifications like this :
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert];但如果我手动去通知设置,禁用一切(通知中心,警报,声音,徽章),然后卸载并重新安装该应用程序(或刚刚重装不卸载第一),我的iPhone保持原来的设置。我怎么可以强制重新激活这些设置回重新安装?
but if I manually go to the notifications settings, disable everything (notification center, alert, sound, badge) then uninstall and reinstall the app (or just reinstall without uninstalling first), my iPhone keeps the old settings. How can I force to reactivate these settings back on reinstallation?
推荐答案您不能。在iOS中5.0有一个没有记录功能,通过一个URL方案,打开你的应用程序的通知设置页面(或任何设置页)。然后,你可以要求用户启用的通知。但它在5.1中删除,反正很可能不会被苹果所接受。
You can't. In iOS 5.0 there was a not documented feature to open the notification setting page (or any setting page) from your application via an url scheme. Then you could ask the user to enable the notifications. But it was removed in 5.1 and anyway probably would not be accepted by Apple.
registerForRemoteNotificationTypes 问他是否愿意接受你的申请的通知只的首次的调用它的用户。如果以后用户更改通知设置那么就不会再问下去了。您可以检查是否通知与 enabledRemoteNotificationTypes 您的应用程序启用和你自己向用户发出警告,如果你想要的,但用户必须手动去设置,并重新启用它们。您不能从您的应用程序做任何更多。
registerForRemoteNotificationTypes asks the user whether he wants to accept notifications from your application only the first time you call it. If later the user changes the notification settings then it will not ask it again any more. You can check whether notifications are enabled for your application with enabledRemoteNotificationTypes and warn the user yourself if you want, but user will have to go manually to the settings and re-enable them. You can't do it any more from your application.
更新内容的iOS 8.0
从iOS的苹果8.0返回的可能性,打开你的应用程序的系统设置页面:
From iOS 8.0 Apple returned the possibility to open the System Settings page of your app:
NSURL* settingsURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString]; [[UIApplication sharedApplication] openURL:settingsURL];更多推荐
如何以编程方式激活的ios通知设置?
发布评论