ios - "Allow Push Notifications"对话框被关闭一次后如何取回?

标签 ios iphone objective-c push-notification apple-push-notifications

我正在构建一个严重依赖 APN 的应用程序。在我的应用程序第一次启动时,iOS 会询问是否允许此应用程序使用 APN(作为 registerForRemoteNotificationTypes: 调用的结果)。但是,一旦关闭,此对话框将永远不会弹出。我必须手动转到 Settings->Notifications->MyApp 以启用/禁用那里的东西。那么有没有一种方法可以避免这种喧嚣,并在每次我以 Debug模式启动我的应用程序时真正体验用户在第一次启动时会体验到的体验?

最佳答案

这里是Apple say你可以做到:

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:

  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 - "Allow Push Notifications"对话框被关闭一次后如何取回?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21571978/

相关文章:

c# - 我应该学习特定于操作系统的语言还是 Java 之类的语言?

ios - UITextView 表情符号字符限制计数不正确

iphone - iPhone 应用程序的套接字超时值

iphone - 将图像添加到自定义单元格 subview

iphone - 用于 iphone/ipad 选择的标签栏自定义图像

objective-c - NSArray 上的 IOS 类别导致 "instance message does not declare a method with selector"

ios - 替换 Collection View 单元格的标签

android - 移动应用程序中的客户端 SSL 证书有多安全?

ios - 如何在 CCCrypt 或 SecKeyEncrypt 之间做出选择

iphone - 以 72 dpi 保存 UIImage(Retina Simulator 以 144 dpi 保存)