【问题标题】:Application failed codesign verification. The signature was invalid, contains disallowed entitlements, or it was not signed with a Distribution应用程序未通过协同设计验证。签名无效,包含不允许的权利,或未使用分发签名
【发布时间】:2012-09-09 10:07:55
【问题描述】:

我正在尝试将 iOS 应用程序推送到 iTunes Connect,但是当我尝试在 Xcode 中验证它时出现此错误:

Application failed codesign verification. The signature was invalid, contains disallowed entitlements, or it was not signed with an iPhone Distribution Certificate

我已经看到了大量与同一问题相关的问题,但这些问题对我不起作用。我遵循 Apple Technical Note TN2250 的每一步。我检查是否在构建设置中选择了一个分发配置文件进行发布(已尝试使用通配符和应用程序的自定义配置文件)并且架构是正确的。为确保应用已使用该配置文件进行签名,我使用了codesign -d -vvvv MyApp.app 命令,并得到如下内容:

Executable=/Users/myuser/Library/Developer/Xcode/Archives/2012-09-17/myapp 17-09-12 09.27.xcarchive/Products/Applications/MyApp.app/MyApp
Identifier=com.example.MyApp
...
Authority=iPhone Distribution: My Company
Authority=Apple Worldwide Developer Relations Certification Authority
Authority=Apple Root CA
...

我用security cms -D -i MyApp.app/embedded.mobileprovision检查了我没有修改的权利,得到这个:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>ApplicationIdentifierPrefix</key>
    <array>
        <string>PR3F1X</string>
    </array>
    <key>CreationDate</key>
    <date>2012-09-17T07:20:35Z</date>
    <key>DeveloperCertificates</key>
    <array>
        <data>
                ...
        </data>
    </array>
    <key>Entitlements</key>
    <dict>
        <key>application-identifier</key>
        <string>PR3F1X.com.example.MyApp</string>
        <key>get-task-allow</key>
        <false/>
        <key>keychain-access-groups</key>
        <array>
            <string>PR3F1X.*</string>
        </array>
    </dict>
    <key>ExpirationDate</key>
    <date>2013-09-16T07:20:35Z</date>
    <key>Name</key>
    <string>PROFILE NAME</string>
    <key>TeamIdentifier</key>
    <array>
        <string>PR3F1X</string>
    </array>
    <key>TimeToLive</key>
    <integer>364</integer>
    <key>UUID</key>
    <string>...</string>
    <key>Version</key>
    <integer>1</integer>
</dict>
</plist>

这个应用程序的 bundle id 看起来像 com.example.MyApp,我认为大写字母可能是问题所在,但更改了它们并没有。之后,我吊销了我的证书,获得了新的 mobileprovision 配置文件并再次经历了整个过程,但没有成功。

我使用的软件是 Xcode 4.3.2 和 Mac OS X 10.7.4

我看不出问题出在哪里,我遗漏了一些东西。

编辑 1: 修改捆绑包 ID 是否需要我手动更改一些其他设置?

编辑 2: 我刚刚从头开始制作了一个示例应用程序,使用相同的证书对其进行了签名,一切顺利,因此问题似乎出在配置中。我正在尝试查看这两个项目设置之间的差异,但唯一值得注意的是第一个仅适用于 iPad,并且使用了几个 PhoneGap 插件。

【问题讨论】:

  • 如果您更改了捆绑 ID,则需要为新 ID 生成新的分发证书。
  • @Abizern 谢谢!!我的意思是我在为应用程序创建分发配置文件之前更改了捆绑 ID。无论如何,如果我使用通配符并且我有正确的 App ID,我就不需要创建一个新的,不是吗?
  • 如果您使用的是 APNS 或 iCloud,则不能使用通配符。
  • 不是这种情况,我没有使用它们中的任何一个。事实上,我认为证书和配置文件都可以,因为我刚刚验证了另一个具有相同应用程序的应用程序。所以我认为问题一定出在其他地方,但是 Xcode 给出的错误不是很清楚。它说:签名无效(正在与另一个项目一起工作),包含不允许的权利(它只有默认权利),或者它没有使用 iPhone 分发证书签名(至少是!!至少是 @987654327 @说...)。这很令人沮丧
  • 我看到您定义了 get-task-allow 键。从 Xcode4 开始你不需要这个

标签: ios xcode app-store-connect code-signing


【解决方案1】:

我遇到了同样的问题。 您必须检查您的应用程序的签名,请参阅How do I check the entitlements on my Application's Signature,其中包含以下内容:

codesign -d --entitlements - /path/to/MyGreatApp.app

它是OK,我不知道你有什么错误,如果你得到类似的东西:

Executable=/path/to/MyGreatApp.app/MyGreatApp
??qq?<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>application-identifier</key>
        <string>ABC123DE45.com.appleseedinc.mygreatapp</string>
        <key>get-task-allow</key>
        <false/>
        <key>keychain-access-groups</key>
        <array>
            <string>ABC123DE45.com.appleseedinc.mygreatapp</string>
        </array>
    </dict>
</plist>

但如果你只得到:

Executable=/path/to/MyGreatApp.app/MyGreatApp

那么,问题来了。可能是您在使用codesign 工具进行代码签名期间损坏了权利。

我已经采取了后续步骤来修复它:

  1. 在 Xcode 中存档任何应用程序。
  2. 选择“分发...”->“保存以供企业临时部署”作为 AppName.ipa
  3. 解压缩 AppName.ipa
  4. 创建应用程序的签名权利文件: codesign -d --entitlements :enterprise.plist Payload/PathToApp.app/
  5. 转到已上传应用所在的文件夹。
  6. 创建配置文件授权文件:

    security cms -D -i /path/to/the.app/embedded.mobileprovision > provision_entitlements.plist

  7. 打开 provision_entitlements.plist 和 enterprise.plist。修改 enterprise.plist 的设置,它应该等于 provision_entitlements.plist->Entitlements 属性。保存更改。

  8. 退出应用程序时,将参数 --entitlements enterprise.plist 添加到协同设计工具。

    codesign -fs "iPhone Distribution: My Company" APP_DIRECTORY --entitlements enterprise.plist
    

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-10-27
    • 1970-01-01
    • 2013-02-10
    • 2011-12-31
    • 2013-10-25
    • 2012-02-11
    相关资源
    最近更新 更多