iPhone SDK推送通知
我在苹果开发人员面板中设置了推送通知,并将代码添加到我的应用程序中。
它在使用开发配置文件的手机上运行良好,但如果我使用分发(临时)配置文件,以便我可以将其提供给一些用户进行测试,则会出现错误并崩溃,日志会显示以下错误
代码:
Thu Jun 25 22:22:35 unknown SpringBoard[729] <Warning>: *** Assertion failure in -[SBRemoteNotificationServer registerApplication:forEnvironment:withTypes:], /SourceCache/SpringBoard/SpringBoard-919.5/SBRemoteNotificationServer.m:633
Thu Jun 25 22:22:35 unknown SpringBoard[729] <Error>: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'no connection found for environment production'
I我在应用程序代码中使用以下代码
:
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
我不明白的是为什么它使用开发配置文件可以完美运行,但在临时情况下它会崩溃。
有谁知道会导致此问题的原因是什么?我尝试过更改很多内容来尝试找到问题,但一无所获。
I have setup push notifications in the apple developer panel and added the code to my application.
It works fine on the phone using a development profile but if I use a distribution (ad-hoc) profile so that I can give it to a few users for testing it gives an error and crashes, the log gives the following error
Code:
Thu Jun 25 22:22:35 unknown SpringBoard[729] <Warning>: *** Assertion failure in -[SBRemoteNotificationServer registerApplication:forEnvironment:withTypes:], /SourceCache/SpringBoard/SpringBoard-919.5/SBRemoteNotificationServer.m:633
Thu Jun 25 22:22:35 unknown SpringBoard[729] <Error>: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'no connection found for environment production'
I am using the following code in the app
Code:
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
The thing I don't understand is why it works perfectly using a development profile but with ad-hoc it crashes.
Does anyone know what would cause this?, I've tried changing lots of things to try and find the issue but have found nothing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我也遇到了这个问题。 症状是应用程序在调用 [[UIApplication sharedApplication] registerForRemoteNotificationTypes:...] 时会崩溃。
似乎一旦给定设备加载了 APNs 分发配置文件,稍后尝试返回使用 APNs 开发配置文件将无法工作,除非您更改应用程序 ID。
如果您在 Xcode 中创建用户定义的构建设置,请按照此处的建议:
iPhone "Good实践”
您可以阻止崩溃,也可以让两个版本在同一设备上共存以进行测试等。
I was having this problem as well. The symptom was the app would crash when calling [[UIApplication sharedApplication] registerForRemoteNotificationTypes:...].
It seems that once a given device loads an APNs Distribution Profile, trying to later go back to using an APNs Development Profile will not work unless you change the App ID.
If you create a user-defined build setting in Xcode, as suggested here:
iPhone "Good Practices"
you can stop the crashing and also have both versions co-exist on the same device for testing, etc.
我通过从 App Store 安装一个使用推送通知的随机应用程序,在我的一台开发设备上解决了这个问题。 在本例中,我安装了 Le Monde.fr 应用程序。 在我运行该应用程序一次后,我自己的应用程序不再崩溃。
I solved this problem on one of my development devices by installing a random application from the App Store which uses push notifications. In this case, I installed the Le Monde.fr application. After I ran that application once, my own application no longer crashed.
我设法通过重新请求所有证书等来使其工作。
I managed to get this working by re-requesting all of the certificates etc..
我通过转到“设置”,然后关闭顶部的“主”推送通知,然后再打开来解决了这个问题。
I solved this by going to Settings, then toggling the top "master" Push Notifications switch off, then back on.
冗长但确定的解决方案是“删除所有内容和设置”。
Lengthy but sure shot solution is to "Erase all Content and Settings".
这是我的解决方案,它与临时配置文件的工作方式有关。 Adhoc 配置文件无法通过 xCode 安装。 您需要构建并存档应用程序,并使用 iTunes 或管理器进行安装。 这为我解决了。
Here's my solution, and it has to do with how adhoc profiles work. Adhoc profiles cannot be installed via xCode. You need to build and archive the app, and install using iTunes or the organizer. That fixed it for me.