仅使用生产证书时无法注册推送通知 [英] Can't register for push notifications while using production certificate only

查看:25
本文介绍了仅使用生产证书时无法注册推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用开发证书时推送通知工作正常.当我在我的临时分发中切换到生产证书时,应用程序无法注册推送通知.在 UIApplicationDelegate 中,didRegisterForRemoteNotificationsWithDeviceTokendidFailToRegisterForRemoteNotificationsWithError 都不会被调用.此外,当我查看设备日志时,我发现了这一点:

Push notifications are working fine when using development certificates. When I switched to a production certificate in my ad-hoc distribution the app fails to register for push notifications. In the UIApplicationDelegate, neither didRegisterForRemoteNotificationsWithDeviceToken nor didFailToRegisterForRemoteNotificationsWithError get called. Additionally when I took a look at the device logs I found this:

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

我在配置文件中的权利密钥如下所示:

My entitlements key in the provisioning profile looks like this:

<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 并从头开始.

I have tried deleting the provisioning profiles from both Xcode and the portal and recreating them, I have also tried revoking the certificates and recreating them. I have even changed the app id and did everything from scratch.

我也尝试过使用和不使用单独的权利文件进行构建.

I have also tried building with and without a separate entitlements file.

更新

我现在正在使用分发配置文件在设备上进行调试.该应用现在可以在生产服务器上成功注册并接收推送通知,但仍会存档应用中断推送通知.

I'm now debugging on the device using a distribution provisioning profile. The app now registers and receives push notifications successfully on the production servers, but still archiving the app breaks push notifications.

所以现在我几乎可以肯定 Xcode 在归档应用程序时搞砸了一些事情.

So now I'm almost sure Xcode is messing up something when archiving the app.

推荐答案

我猜对了,Xcode 在归档应用程序时确实搞砸了一些事情.选择Save for Enterprise or Ad-Hoc Deployment"后,代码签名身份下拉菜单显示我的团队名称为(null)".

I was guessing right, Xcode was indeed messing up something when archiving the app. After selecting "Save for Enterprise or Ad-Hoc Deployment", the code signing identity drop down menu was showing my team name as '(null)'.

刷新代码签名身份后,它现在可以正常显示,临时 ipa 现在可以在我的设备上正常注册和接收推送通知.

After refreshing the code signing identities it's now showing up properly and the ad-hoc ipa now registers and receives push notifications normally on my device.

这篇关于仅使用生产证书时无法注册推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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