问题描述
概述
我们的命令行构建(构建和创建.ipa)不再有效。
Our command line builds (to build and create the .ipa) are no longer working.
iTunesConnect已开始拒绝使用 CODE_SIGN_RESOURCE_RULES_PATH
构建设置的构建。
iTunesConnect has started rejecting builds that use the CODE_SIGN_RESOURCE_RULES_PATH
build setting.
如果我们构建没有该设置,PackageApplication工具(我们用来创建签名的.ipa)失败。
If we build WITHOUT that setting the PackageApplication tool (which we use to create the signed .ipa) fails.
似乎PackageApplication调用/ usr / bin / codesign with resource-rules参数,即使排除 CODE_SIGN_RESOURCE_RULES_PATH
构建设置
It seems that PackageApplication calls /usr/bin/codesign with resource-rules arguments even if the CODE_SIGN_RESOURCE_RULES_PATH
build setting is excluded
我怀疑PackageApplication需要更新,以便在排除 CODE_SIGN_RESOURCE_RULES_PATH
构建设置时,不会使用resource-rules参数调用/ usr / bin / codesign。
I suspect the PackageApplication needs to be updated so that it does not call /usr/bin/codesign with resource-rules arguments when the CODE_SIGN_RESOURCE_RULES_PATH
build setting is excluded.
有没有人为此找到解决方案?
Has anyone found a solution for this?
详细信息
我们在命令行上构建我们的应用程序,如下所示:
We build our app on the command line like this:
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如下:
We create the signed .ipa on the command line like this:
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 is现在拒绝我们的构建时出现以下错误:
iTunesConnect is now rejecting our builds with the following error:
如果我们删除构建命令中的'CODE_SIGN_RESOURCE_RULES_PATH = $(SDKROOT)/ResourceRules.plist'
位,然后构建的应用程序没有 CFBundleResourceSpecification
plist键(我认为是我们想要的)。新的构建命令如下所示:
If we remove the 'CODE_SIGN_RESOURCE_RULES_PATH=$(SDKROOT)/ResourceRules.plist'
bit from the build command then the app is built without the CFBundleResourceSpecification
plist key (which I presume is what we want). The new build command looks like this:
xcodebuild -workspace myApp.xcworkspace -scheme myApp -sdk iphoneos -configuration AppStoreDistribution OBJROOT=$PWD/build SYMROOT=$PWD/build ONLY_ACTIVE_ARCH=NO
现在的问题是构建.ipa的命令失败并出现以下错误:
The problem now is that the command to build the .ipa fails with the following error:
警告: - Mac OS X中已弃用--resource-rules> = 10.10!
/var/folders/2b/7hylk7nn13dgrl9yyh2wp0lm0000gn/T/zDRRJMkKtQ/Payload/myApp.app/ResourceRules.plist:
无法读取资源
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
参数/构建设置。
It seems that PackageApplication calls /usr/bin/codesign with resource-rules arguments even if the CODE_SIGN_RESOURCE_RULES_PATH
argument / build setting is excluded.
我认为需要更新PackageApplication,以便在 CODE_SIGN_RESOURCE_RULES_PATH 参数/构建设置被排除。
I think PackageApplication needs to be updated so that it does not call /usr/bin/codesign with resource-rules arguments when the
CODE_SIGN_RESOURCE_RULES_PATH
argument / build setting is excluded.
推荐答案
Apple通过解决方案回复了我。从Xcode 7开始,我们应该使用
xcodebuild
而不是 PackageApplication
来生成.ipa文件。
Apple got back to me with a solution. As of Xcode 7 we should use
xcodebuild
instead of PackageApplication
to produce the .ipa file.
xcodebuild有一个新的-exportArchive选项来创建一个更像Xcode Organizer的.ipa。
xcodebuild has a new -exportArchive option to create an .ipa that works more like Xcode Organizer.
所以我们现在应该:
- 使用
xcodebuild存档构建存档
- 使用
创建.ipa xcodebuild -exportArchive
build an archive with
xcodebuild archive
create the .ipa with
xcodebuild -exportArchive
我们现在构建这样的存档:
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
These two command create the files
build/myApp.xcarchive
and build/myApp.ipa
请注意
xcodebuild -exp ortArchive
需要一个 -exportOptionsPlist
参数,该参数指向带有导出选项的.plist文件。有关可以放入该plist的完整列表,请运行 xcodebuild -help
。该文件的最小内容如下所示:
Note that
xcodebuild -exportArchive
requires a -exportOptionsPlist
argument that points to a .plist file with export options. For a complete list of what you can put in that plist, run xcodebuild -help
. The minimal contents of the file looks like this:
<?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>
在Xcode 9中,您现在必须在exportOptions.plist中指定更多详细信息,如下所示:
In Xcode 9, you now have to specify more details in exportOptions.plist like below:
<?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>compileBitcode</key>
<false/>
<key>method</key>
<string>ad-hoc</string>
<key>provisioningProfiles</key>
<dict>
<key>my.bundle.idenifier</key>
<string>My Provisioning Profile Name</string>
</dict>
<key>signingCertificate</key>
<string>iPhone Distribution</string>
<key>signingStyle</key>
<string>manual</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>YOURTEAMID</string>
<key>thinning</key>
<string><none></string>
</dict>
</plist>
这篇关于iOS构建/ ipa创建不再适用于命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!