如何取回“允许推送通知"关闭一次后的对话框? [英] How to get back "Allow Push Notifications" dialog after it was dismissed once?

查看:36
本文介绍了如何取回“允许推送通知"关闭一次后的对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个严重依赖 APN 的应用.在我的应用程序第一次启动时,iOS 会询问是否允许此应用程序使用 APN(作为 registerForRemoteNotificationTypes: 调用的结果).然而,一旦被解雇,这个对话框就永远不会弹出.我必须手动转到 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?

推荐答案

Apple 说 你可以做到:

在 iOS 上重置推送通知权限警报

Resetting the Push Notifications Permissions Alert on iOS

启用推送的应用第一次注册推送通知时,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. 从设备中删除您的应用.

  1. 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.

这篇关于如何取回“允许推送通知"关闭一次后的对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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