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