xcodebuild 存档未通过 ITMS 验证

Posted

技术标签:

【中文标题】xcodebuild 存档未通过 ITMS 验证【英文标题】:xcodebuild archive fails ITMS validation 【发布时间】:2015-08-13 19:05:54 【问题描述】:

我们的应用有一个 watchkit 应用 + 扩展。来自 XCode IDE 的档案总是通过 iTunes 商店验证。但是,通过 xcodebuild 命令工具(Xcode 6.4;构建版本 6E35b)生成的存档无法通过此验证,并出现以下错误:

ERROR ITMS-90163: "Invalid Code Signing Entitlements. The entitlements in your app bundle signature do not match the ones that are contained in the provisioning profile. The bundle contains a key that is not included in the provisioning profile: 'aps-environment' in 'Payload/TheDodo.app/PlugIns/DodoExtension.appex/DodoExtension'."

ERROR ITMS-90164: "Invalid Code Signing Entitlements. The entitlements in your app bundle signature do not match the ones that are contained in the provisioning profile. According to the provisioning profile, the bundle contains a key value that is not allowed: '##########.###.##########.######' for the key 'application-identifier' in 'Payload/TheDodo.app/PlugIns/TheDodoWatchKitExtension.appex/TheDodoWatchKitExtension'"

ERROR ITMS-90163: "Invalid Code Signing Entitlements. The entitlements in your app bundle signature do not match the ones that are contained in the provisioning profile. The bundle contains a key that is not included in the provisioning profile: 'aps-environment' in 'Payload/TheDodo.app/PlugIns/TheDodoWatchKitExtension.appex/TheDodoWatchKitExtension'."

ERROR ITMS-90046: "Invalid Code Signing Entitlements. Your application bundle's signature contains code signing entitlements that are not supported on ios. Specifically, value '##########.###.##########.######' for key 'application-identifier' in 'Payload/TheDodo.app/PlugIns/TheDodoWatchKitExtension.appex/TheDodoWatchKitExtension' is not supported. This value should be a string starting with your TEAMID, followed by a dot '.', followed by the bundle identifier."

ERROR ITMS-90163: "Invalid Code Signing Entitlements. The entitlements in your app bundle signature do not match the ones that are contained in the provisioning profile. The bundle contains a key that is not included in the provisioning profile: 'aps-environment' in 'Payload/TheDodo.app/PlugIns/TheDodoWatchKitExtension.appex/TheDodoWatchKitApp.app/TheDodoWatchKitApp'."

ERROR ITMS-90163: "Invalid Code Signing Entitlements. The entitlements in your app bundle signature do not match the ones that are contained in the provisioning profile. The bundle contains a key that is not included in the provisioning profile: 'com.apple.security.application-groups' in 'Payload/TheDodo.app/PlugIns/TheDodoWatchKitExtension.appex/TheDodoWatchKitApp.app/TheDodoWatchKitApp'."

要归档和导出的 Makefile 如下所示:

/usr/bin/xcodebuild -verbose -verbose -workspace 'rebelmouse.xcworkspace'  -scheme TheDodo -configuration "App Store" -sdk 'iphoneos' -archivePath /tmp/TheDodo.xcarchive -derivedDataPath /tmp/ROJECT.Ji9vwyH0 APPLICATION_BUILD_VERSION=2456 archive

/usr/bin/xcodebuild -exportArchive -exportFormat ipa -archivePath /tmp/TheDodo.xcarchive -exportPath /tmp/TheDodo.ipa -exportWithOriginalSigningIdentity

非常感谢任何建议/帮助。提前致谢。

【问题讨论】:

您找到解决方案了吗?我也遇到同样的问题... 目前没有解决方案,希望 XCode 7 能解决这个问题。在苹果论坛问了同样的问题,有这样的回复 - forums.developer.apple.com/thread/14378 有趣的答案。不幸的是,它没有提供解决方案。谢谢。 【参考方案1】:

回答这个问题以防其他人被困在同一条船上。

在 Xcode 7.0 中,xcodebuild 获得了一个新的命令行选项来导出存档,即 exportOptionsPlist ,这需要配置存档的 plist 的完整路径。

您不再需要设置-exportFormat

xcodebuild --help 列出 plist 的详细信息。

对于企业构建,我使用这个 plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>method</key>
    <string>enterprise</string>
</dict>
</plist>

对于 App Store 版本,将 enterprise 替换为 app-store

【讨论】:

【参考方案2】:

告诉 xcodebuild 要使用的配置文件的名称,而不是让它“自动搜索”它:

 xcodebuild -exportArchive -exportFormat ipa -archivePath "FOLD/FILE.xcarchive" -exportPath "FOLD/FILE.ipa" -exportProvisioningProfile "NAME" > /dev/null || exit 1

【讨论】:

遗憾的是,如果应用程序有 Watchkit 扩展,这将不起作用 - 因为它们都使用不同的配置文件。 嗯,好的。那谢谢?

以上是关于xcodebuild 存档未通过 ITMS 验证的主要内容,如果未能解决你的问题,请参考以下文章

错误 ITMS-9000:“不支持的架构。Xcode 存档错误

ERROR ITMS-90046 using xctool / xcodebuild vs XCode Archive 的成功

xcodebuild:“未找到适用的设备。”导出存档时

未找到 xcodebuild 配置文件?

如何在 xcodebuild 命令中传递配置文件名称?

xcodebuild 命令无法生成 iPA