【发布时间】:2019-02-08 09:19:24
【问题描述】:
我满足推送通知的所有要求。 在 iTunes 连接中启用功能,然后创建分发配置文件。
在调试模式下,我的应用调用:didRegisterForRemoteNotificationsWithDeviceToken。
但在发布构建应用程序调用:didFailToRegisterForRemoteNotificationsWithError 错误:
Domain=NSCocoaErrorDomain Code=3000 "没有有效的 'aps-environment' 找到应用程序的权利字符串”
在项目中,我有 xxx.entitlements:
<dict>
<key>aps-environment</key>
<string>production</string>
</dict>
我的 xxx.mobileprovision 包含以下字符串:
<key>Entitlements</key>
<dict>
<key>keychain-access-groups</key>
<array>
<string>XXXXXXXXXX.*</string>
</array>
<key>get-task-allow</key>
<false/>
<key>application-identifier</key>
<string>XXXXXXXXXXX.MyBundleId</string>
<key>com.apple.developer.team-identifier</key>
<string>XXXXXXXXXXX</string>
<key>aps-environment</key>
<string>production</string>
</dict>
导出 Ad hoc 包后,我使用命令 codesign -d --entitlements MyApp.app
<key>application-identifier</key>
<string>XXXXXXXXXXX.MyBundleId</string>
<key>com.apple.developer.team-identifier</key>
<string>XXXXXXXXXXX</string>
<key>get-task-allow</key>
<false/>
<key>keychain-access-groups</key>
<array>
<string>XXXXXXXXXXX.MyBundleId</string>
</array>
其中 XXXXXXXXXXX 是团队 ID,并且在任何地方都是平等的。
谁能告诉我是什么导致了这个错误?提前致谢!
【问题讨论】:
-
@AshokPolu 没有一个答案可以解决我的问题。而且它仍然无法在 testflight 中运行。
-
您是否有生产推送通知证书,如果没有,请创建一个并手动选择“发布”模式而不是“自动代码签名”的临时配置文件。
标签: ios xcode apple-push-notifications