推送通知适用于 Ad Hoc,但不适用于从 Apple 商店下载的情况
我的应用程序刚刚获得苹果商店批准。我下载了它并将其安装在我的 iPhone 上 - 但看起来推送通知已损坏!
我使用临时配置文件在生产中成功测试了推送通知。我没有任何问题。当我提交给苹果时,我做的唯一不同的事情是使用应用程序商店分发配置文件。
该应用程序从不询问我(或下载该应用程序的任何其他人)是否想接收推送通知。因此,手机永远不会与我的服务器通信以发送推送令牌(因为 application:didRegisterForRemoteNotificationsWithDeviceToken: 可能从未被调用)。此外,该应用程序不会出现在通知设置下的设置应用程序中。
我可能做错了什么?
编辑:当应用程序等待批准时,我在生成生产推送证书时遇到了一些问题。这可能相关吗?
My app just got approved for the apple store. I downloaded it an installed it on my iPhone - but it looks like push notifications are broken!
I was successfully testing push notifications in production using an adHoc provisioning profile. I had no problems. The only thing I did differently when I submitted to apple was using an app store distribution profile.
The application never asks me (or anyone else who has downloaded it) if I want to receive push notifications. Consequently, the phone never talks to my server to send the push token (because application:didRegisterForRemoteNotificationsWithDeviceToken: is presumably never called). Also the application does not appear in the settings app under the notification settings.
What could I be doing wrong??
EDIT: While the app was awaiting approval, I was having some trouble generating my production push certificate. Could this be relevant?
Problem generating APN SSL certificate after submitting to apple store
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确保您已创建生产应用程序 ID 并已在其上启用推送通知。然后为该应用程序创建配置文件。下载并使用文本编辑器打开文件,以确保配置文件包含此键和值:
aps-environment
生产
如果没有,请确保在生成配置文件之前确实已启用用于生产推送的应用程序 ID。
完成构建后,您可以检查最终构建以验证它是否具有 aps-environment 权利(您正在“内部要求”下查找 aps-environment 代码签名权利):
codesign -dvvvv --entitlements - MyCoolApp.app
Be sure you've created your production App ID and have enable push notifications upon it. Then create the provisioning profile for that app. Download and open the file with a text editor to MUST make sure that the profile contains this key and value:
aps-environment
production
If not, then make sure you really have enabled the app ID for production push before you generated your provisioning profile.
After you make your build, you can check the final build to verify it has the aps-environment entitlement (you're looking for the aps-environment code signing entitlement under "Internal requirements):
codesign -dvvvv --entitlements - MyCoolApp.app
您是否对 ad-hoc 和分发 mobileprovision 文件使用了相同的应用程序 ID?它需要是一个完整的标识符,而不仅仅是部分标识符。
Did you use the same Application ID for both the ad-hoc and the distribution mobileprovision files? It needs to be a complete identifier, rather than just partial.