iOS builds/ipa创建不再从命令行工作

概述

我们的命令行构建(构建和创建.ipa)不再工作。

iTunesConnect已开始拒绝使用CODE_SIGN_RESOURCE_RULES_PATH构建设置的构建。

如果我们构建WITHOUT的设置PackageApplication工具(我们用于创建签名的.ipa)失败。

看来PackageApplication使用resource-rules参数调用/ usr / bin / codesign,即使排除了CODE_SIGN_RESOURCE_RULES_PATH构建设置

我怀疑PackageApplication需要更新,以便它不会调用/ usr / bin / codesign与resource-rules参数,当CODE_SIGN_RESOURCE_RULES_PATH构建设置被排除。

有没有人找到一个解决方案?

细节

我们在命令行上创建我们的应用程序,像这样:

xcodebuild -workspace myApp.xcworkspace -scheme myApp -sdk iphoneos -configuration AppStoreDistribution OBJROOT=$PWD/build SYMROOT=$PWD/build ONLY_ACTIVE_ARCH=NO 'CODE_SIGN_RESOURCE_RULES_PATH=$(SDKROOT)/ResourceRules.plist'

我们在命令行上创建签名的.ipa,如下所示:

xcrun -log -sdk iphoneos PackageApplication "/Users/mpv/dev/myApp/build/AppStoreDistribution-iphoneos/myApp.app" -o "/Users/mpv/dev/myApp/build/AppStoreDistribution-iphoneos/myApp.ipa" -sign "iPhone Distribution: MyTeam (XXXXXXXXXX)" -embed /Users/mpv/Library/MobileDevice/Provisioning\ Profiles/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.mobileprovision

iTunesConnect现在拒绝我们的构建与以下错误:

“This bundle is invalid. The Info.plist contains an invalid key
‘CFBundleResourceSpecification’ in bundle myApp [myApp.app]”

如果我们从build命令中删除“CODE_SIGN_RESOURCE_RULES_PATH = $(SDKROOT)/ResourceRules.plist”位,那么该应用程序不使用CFBundleResourceSpecification plist键(我假定是我们想要的)。新建命令如下所示:

xcodebuild -workspace myApp.xcworkspace -scheme myApp -sdk iphoneos -configuration AppStoreDistribution OBJROOT=$PWD/build SYMROOT=$PWD/build ONLY_ACTIVE_ARCH=NO 

现在的问题是,构建.ipa的命令失败,并显示以下错误:

error: /usr/bin/codesign –force
–preserve-metadata=identifier,entitlements,resource-rules –sign iPhone Distribution: MyTeam (XXXXXXXXXX)
–resource-rules=/var/folders/2b/7hylk7nn13dgrl9yyh2wp0lm0000gn/T/zDRRJMkKtQ/Payload/myApp.app/ResourceRules.plist
–entitlements /var/folders/2b/7hylk7nn13dgrl9yyh2wp0lm0000gn/T/zDRRJMkKtQ/entitlements_plistIUdGWLYe
/var/folders/2b/7hylk7nn13dgrl9yyh2wp0lm0000gn/T/zDRRJMkKtQ/Payload/myApp.app
failed with error 1. Output: Warning: usage of –preserve-metadata
with option “resource-rules” (deprecated in Mac OS X >= 10.10)!

Warning: –resource-rules has been deprecated in Mac OS X >= 10.10!
/var/folders/2b/7hylk7nn13dgrl9yyh2wp0lm0000gn/T/zDRRJMkKtQ/Payload/myApp.app/ResourceRules.plist:
cannot read resources

看来PackageApplication使用resource-rules参数调用/ usr / bin / codesign,即使排除了CODE_SIGN_RESOURCE_RULES_PATH参数/构建设置。

我认为PackageApplication需要更新,以便它不会调用/ usr / bin / codesign与资源规则参数,当CODE_SIGN_RESOURCE_RULES_PATH参数/构建设置被排除。

苹果回来给我一个解决方案。从Xcode 7开始,我们应该使用xcodebuild代替PackageApplication来生成.ipa文件。

xcodebuild有一个新的-exportArchive选项来创建一个更像Xcode Organizer的.ipa。

所以我们现在应该:

>使用xcodebuild存档创建一个存档
>使用xcodebuild -exportArchive创建.ipa

我们现在构建这样的归档文件:

xcodebuild -workspace myApp.xcworkspace -scheme myApp -sdk iphoneos -configuration AppStoreDistribution archive -archivePath $PWD/build/myApp.xcarchive

我们现在导出.ipa这样:

xcodebuild -exportArchive -archivePath $PWD/build/myApp.xcarchive -exportOptionsPlist exportOptions.plist -exportPath $PWD/build

这两个命令创建文件build / myApp.xcarchive和build / myApp.ipa

请注意,xcodebuild -exportArchive需要一个-exportOptionsPlist参数,它指向带有导出选项的.plist文件。有关您可以放入plist的完整列表,请运行xcodebuild -help。文件的最小内容如下所示:

<?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>method</key>
    <string>app-store</string>
    <key>teamID</key>
    <string>YOUR_TEN_CHARACTER_TEAM_ID</string>
</dict>
</plist>
翻译自:https://stackoverflow.com/questions/32763288/ios-builds-ipa-creation-no-longer-works-from-the-command-line

转载注明原文:iOS builds/ipa创建不再从命令行工作