我正在构建一个非常依赖APN的应用程序。 在我的应用程序第一次启动时,iOS会询问这个应用程序是否允许使用APN(作为registerForRemoteNotificationTypes: call的结果)。 但是一旦被解雇,这个对话框永远不会弹出。 我必须手动去Settings->Notifications->MyApp启用/禁用那里的东西。 那么有一种方法可以避免这种喧嚣,实际上每次在调试模式下启动我的应用程序时,都会体会到用户在第一次启动时会体验到什么?
I am building an app that is heavily relies on APN. Upon the very first start of my app, iOS asks if this app is allowed to use APN (as a result of registerForRemoteNotificationTypes: call). However once dismissed, this dialog is never popping up back. I have to manually go to Settings->Notifications->MyApp to enable/disable things there. So is there a way to avoid this hustle and actually experience what user will experience upon the very first start every time I start my app in debug mode?
最满意答案
苹果说你可以这样做:
重置iOS上的推送通知权限提醒
第一次推送应用程序注册推送通知时,iOS会询问用户是否希望收到该应用的通知。 一旦用户对此提醒做出了回应,除非恢复设备或应用程序已卸载至少一天,否则不会再显示该警报。
如果要模拟应用程序的首次运行,可以将应用程序卸载一天。 您可以实现后者,而不需要按照以下步骤实际上等待一天:
从设备中删除您的应用程序。
关闭设备完全关闭,然后重新打开。
转到设置>常规>日期和时间,并将日期提前一天或更长时间。
再次关闭设备,然后重新打开。
Here's how Apple say you can do it:
Resetting the Push Notifications Permissions Alert on iOS
The first time a push-enabled app registers for push notifications, iOS asks the user if they wish to receive notifications for that app. Once the user has responded to this alert it is not presented again unless the device is restored or the app has been uninstalled for at least a day.
If you want to simulate a first-time run of your app, you can leave the app uninstalled for a day. You can achieve the latter without actually waiting a day by following these steps:
Delete your app from the device.
Turn the device off completely and turn it back on.
Go to Settings > General > Date & Time and set the date ahead a day or more.
Turn the device off completely again and turn it back on.
更多推荐
发布评论