推送通知在使用开发证书时工作正常。当我在临时分发中切换到生产证书时,应用程序无法注册推送通知。在 UIApplicationDelegate 中,didRegisterForRemoteNotificationsWithDeviceToken
和 didFailToRegisterForRemoteNotificationsWithError
都不会被调用。此外,当我查看设备日志时,我发现了这一点:
Sep 30 12:47:09 Heshams-iPad amfid[483] <Error>: entitlement 'aps-environment' has value not permitted by a provisioning profile
Sep 30 12:47:09 Heshams-iPad amfid[483] <Error>: entitlement 'application-identifier' has value not permitted by a provisioning profile
Sep 30 12:47:09 Heshams-iPad amfid[483] <Error>: entitlement 'aps-environment' has value not permitted by a provisioning profile
Sep 30 12:47:09 Heshams-iPad amfid[483] <Error>: entitlement 'aps-environment' has value not permitted by a provisioning profile
Sep 30 12:47:09 Heshams-iPad amfid[483] <Error>: entitlement 'application-identifier' has value not permitted by a provisioning profile
我在配置文件中的授权 key 如下所示:
<key>Entitlements</key>
<dict>
<key>application-identifier</key>
<string>KUK8W9TW2G.com.startappz.ConversableDemo</string>
<key>aps-environment</key>
<string>production</string>
<key>get-task-allow</key>
<false/>
<key>keychain-access-groups</key>
<array>
<string>KUK8W9TW2G.*</string>
</array>
</dict>
我尝试从 Xcode 和门户中删除配置文件并重新创建它们,我还尝试撤销证书并重新创建它们。我什至更改了应用程序 ID,一切都从头开始。
我还尝试过使用和不使用单独的权利文件进行构建。
更新
我现在正在使用分发配置文件在设备上进行调试。该应用程序现在可以在生产服务器上成功注册和接收推送通知,但仍然归档该应用程序会中断推送通知。
所以现在我几乎可以肯定 Xcode 在归档应用程序时搞砸了一些东西。
最佳答案
您是否更改了服务器中的 APNS 脚本?
ssl://gateway.sandbox.push.apple.com:2195 需要; ssl://gateway.push.aple.com:2195 和
development_certificate.pem 应该是; 生产证书.pem
关于ios - 仅使用生产证书时无法注册推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12660931/