【问题标题】:no valid 'aps-environment' entitlement string found for application in relesase build only仅在发布版本中找不到适用于应用程序的有效“aps-environment”权利字符串
【发布时间】: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


【解决方案1】:

这是因为我在启用推送功能后在项目设置中使用手动签名。之后,在 project.pbxproj 中相应构建(发布)的 buildSettings 部分不包含

CODE_SIGN_ENTITLEMENTS = MyApp/MyApp.entitlements;字符串。

通过在项目设置中重新启用推送功能解决了这个问题。

【讨论】:

    猜你喜欢
    • 2012-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-04
    • 2012-09-20
    • 2015-02-04
    • 1970-01-01
    相关资源
    最近更新 更多