重置应用的推送通知设置 [英] Reset push notification settings for app

查看:162
本文介绍了重置应用的推送通知设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用推送通知开发应用。要检查所有可能的用户交互方式,我想在用户拒绝在第一次启动时为我的应用启用推送通知时测试我的应用。

I am developing an app with push notifications. To check all possible ways of user interaction, I'd like to test my app when a user declines to have push notifications enabled for my app during the first start.

然而,对话框(由 registerForRemoteNotificationTypes 启动)每个应用只出现一次。如何重置iPhone OS的应用程序内存。删除应用程序并重新安装没有帮助。

The dialog (initiated by registerForRemoteNotificationTypes), however, appears only once per app. How do I reset the iPhone OS's memory of my app. Deleting the app and reinstalling doesn't help.

推荐答案

技术说明TN2265:推送通知疑难解答


第一次启用推送的应用
注册推送通知,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.

如果您想模拟应用程序的第一次
运行,您可以将应用程序
卸载一天。 你可以通过设置一天或更长时间的系统时钟
,完全关闭
设备,然后转为$ b,而实际上可以实现后者
而不实际等待
天$ b设备重新开启。

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 setting the system clock forward a day or more, turning the device off completely, then turning the device back on.

更新:如下面的评论中所述,此解决方案自iOS 5.1起停止工作。我鼓励向Apple提交一个错误,以便他们可以更新他们的文档。目前的解决方案似乎是重置设备的内容和设置。

Update: As noted in the comments below, this solution stopped working since iOS 5.1. I would encourage filing a bug with Apple so they can update their documentation. The current solution seems to be resetting the device's content and settings.

更新技术说明已更新,其新步骤可正常工作iOS 7。

Update: The tech note has been updated with new steps that work correctly as of iOS 7.



  1. 从设备中删除您的应用。

  2. 完全关闭设备并重新打开。

  3. 转到设置>常规>日期&时间并将日期提前一天或更长时间。

  4. 再次完全关闭设备并重新打开。

  1. Delete your app from the device.
  2. Turn the device off completely and turn it back on.
  3. Go to Settings > General > Date & Time and set the date ahead a day or more.
  4. Turn the device off completely again and turn it back on.







自iOS 9起更新

只需删除并重新安装应用即可将通知状态重置为 notDetermined (意味着会出现提示)。

Simply deleting and reinstalling the app will reset the notification status to notDetermined (meaning prompts will appear).

感谢Gomfucius的答案如下:
https://stackoverflow.com/a/33247900/704803

Thanks to the answer by Gomfucius below: https://stackoverflow.com/a/33247900/704803

这篇关于重置应用的推送通知设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆