如何以编程方式激活的ios通知设置?

编程入门 行业动态 更新时间:2024-10-24 18:28:51
本文介绍了如何以编程方式激活的ios通知设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

像这样的通知,我的应用程序寄存器:

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通知设置?

本文发布于:2023-11-27 20:16:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1639452.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:方式   通知   ios

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!