重置ios5中的推送通知权限设置 [英] Reset push notification permission setting in ios5
问题描述
我正在开发一个使用推送通知的应用,并在使用iOS 5.1.1的设备上进行测试。我想测试在应用首次运行期间提示用户有关推送通知的情况。该对话框在我第一次调用registerForRemoteNotificationTypes时出现,但从未再次出现,即使从头开始重新安装该应用程序也是如此。如何清除设置以便再次出现对话框?
I am developing an app that uses push notifications, and testing on a device with iOS 5.1.1. I would like to test the scenario where the user is prompted about push notifications during the app's first run. The dialog appears the first time I call registerForRemoteNotificationTypes, but never appears again, even if the app is re-installed from scratch. How can I clear the setting so that the dialog will appear again?
同样的问题是,但答案不适用于iOS 5或更高版本,如评论中所述。
The same question was posted before, but the answers do not work for iOS 5 or later, as noted in the comments there.
Apple的文档说要卸载应用程序并弄乱时钟使其看起来像应用程序已卸载一天,但这在iOS5上不起作用。
Apple's documentation says to uninstall the app and mess with the clock to make it look like the app was uninstalled for a day, but this does not work on iOS5.
另一个答案建议运行常规 - >重置 - >删除所有内容和设置 - 我试过这个,但它冻结了我的设备,我最终不得不重新启动它。在任何情况下,这都是一个严格的解决方案,不适合测试。
Another answer suggested running General -> Reset -> Erase All Content And Settings - I tried this, but it froze my device and I ended up having to power-cycle it. In any case, this is a heavy-handed solution that is not practical for testing.
另一个答案建议从/ private / var / mobile / Library /删除你的应用程序的条目RemoteNotification / Clients.plist,但iOS5上不存在此文件。
Another answer suggested removing your app's entry from /private/var/mobile/Library/RemoteNotification/Clients.plist, but this file does not exist on iOS5.
有没有办法在iOS5上完成此操作?
Is there a way to accomplish this on iOS5?
推荐答案
我找到了一个解决方案,如果你的设备被越狱了:
I found a solution that works if your device is jailbroken:
- 使用像iFile这样的应用程序用属性列表查看器打开文件
/var/mobile/Library/SpringBoard/applicationstate.plist
- 查找您的应用程序的包标识符并删除密钥
SBRemoteNotificationClient
- 重新启动SpringBoard - 重启设备,SSH到设备并运行
killall SpringBoard
,或使用Respring应用。
- Use an app like iFile to open the file
/var/mobile/Library/SpringBoard/applicationstate.plist
with a property list viewer - Find your app's bundle identifier and delete the key
SBRemoteNotificationClient
- Restart SpringBoard - either reboot the device, SSH to the device and run
killall SpringBoard
, or use the Respring app.
下次运行应用时,它将再次显示通知权限对话框。
Next time you run your app, it will show the notification permission dialog once again.
我已经测试了t他的iOS 5.1.1。
I've tested this on iOS 5.1.1.
这篇关于重置ios5中的推送通知权限设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!