6

我正在尝试将 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技术说明 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>

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

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

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

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

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

4

1 回答 1

0

I had the same problem. You had to check your Application's Signature, see How do I check the entitlements on my Application's Signature with following:

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

It's OK and I don't know what the error you have, if you get something like:

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>

But If you get only:

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

Then, it's a problem. Probably, you damaged the entitlements during the code resigning with codesign tool.

I've made next steps to fix it:

  1. Archive any app in Xcode.
  2. Choose 'Distribute ...'->'Save for Enterprise Ad-Hoc Deployment' as AppName.ipa
  3. Unzip AppName.ipa
  4. Create Application's Signature entitlements file: codesign -d --entitlements :enterprise.plist Payload/PathToApp.app/
  5. Go to the folder where uploaded app located.
  6. Create Provisioning profile entitlements file:

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

  7. Open provision_entitlements.plist and enterprise.plist. Modify settings of enterprise.plist , it should be equal to provision_entitlements.plist->Entitlements property. Save the changes.

  8. When resign the app add argument --entitlements enterprise.plist to codesign tool.

    codesign -fs "iPhone Distribution: My Company" APP_DIRECTORY --entitlements enterprise.plist
    
于 2013-05-06T10:56:45.157 回答