Xcode 6.1 error while building IPA

2019-01-07 02:13发布

Just upgraded to Xcode 6.1 today, and guess what: Now I'm having trouble submitting builds using the TestFlight desktop app. Here's the error I'm getting while the app starts building the IPA:

The error

error: /usr/bin/codesign --force --preserve-metadata=identifier,entitlements,resource-rules --sign 854059d45eed724593debef577a562e1ba96ab55 --resource-rules=/tmp/QYFSJIvu7W/Payload/XX.app/ResourceRules.plist /tmp/QYFSJIvu7W/Payload/XX.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! /tmp/QYFSJIvu7W/Payload/XX.app/ResourceRules.plist: cannot read resources

The 'Support Article' has no idea what is going on.

It does not seem to be a TestFlight problem because the same thing happens in a CI environment like Jenkins using the xcrun or similar tools.

The app wasn't updated for months, so I know that I shouldn't be expecting for any updates to fix this anytime soon. It used to work really well for me and my clients so I'm not really keen on abandoning it for something else either.

Any ideas for what this error is about, and how to fix it would be very appreciated.

7条回答
来,给爷笑一个
2楼-- · 2019-01-07 02:47

The answer by Tim Gostony no longer works since the release of Xcode 7. Now the App Store submission process fails when resource rules are present. The solution is to clear your Code Signing Resource Rules Path and replace xcrun with xcodebuild tool:

xcodebuild -exportArchive -archivePath [path to archive] -exportPath [path to output directory] -exportOptionsPlist [path to options.plist file]

The simplest Options.plist for exporting ad-hoc distribution ipa files 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>iCloudContainerEnvironment</key>
    <string>Production</string>
    <key>teamID</key>
    <string>[YOUR TEAM ID]</string>
    <key>method</key>
    <string>ad-hoc</string>
</dict>
</plist>

There are other options available for this plist file regarding bitcode, app thinning, etc. That's why I think xcodebuild tool is the right tool for exporting ipa files for iOS 9 and above.

More details about options plist are available with xcodebuild -help command.

查看更多
不美不萌又怎样
3楼-- · 2019-01-07 02:53

I wish I knew why it works, but here's a fix that worked for me:

Found the fix !

Click on your project > Targets > Select your target > Build Settings >

Code Signing Resource Rules Path

and add :

$(SDKROOT)/ResourceRules.plist

查看更多
冷血范
4楼-- · 2019-01-07 02:53

I emailed TestFlight support and got this response:

Our team is currently investigating this issue with the TestFlight Desktop app. In the meantime, please use Xcode to create the IPA file and then upload it using the desktop app or the TestFlight website.

The suggested workaround did work.

查看更多
倾城 Initia
5楼-- · 2019-01-07 02:57

As specified in another answer, you can also just not specify the distribution certificate to sign with and it will package correctly. TestFlight would need to update their app to do this.

查看更多
唯我独甜
6楼-- · 2019-01-07 03:02

On Yosemite w/ XCode 6.4 even using the SDKROOT patch the codesigning fails. The following article explains how to patch the XCode script to get around this. Note that this is patching XCode, so it is version specific, but fixes the problem.

http://www.jayway.com/2015/05/21/fixing-your-ios-build-scripts

查看更多
淡お忘
7楼-- · 2019-01-07 03:09

The following patch for PackageApplications fixed it for me, I removed resource-rules as it says it's deprecated on 10.10.

Testflight builds work without it. Appstore builds too.

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin
 % diff PackageApplication PackageApplicationFixed 
155,157c155,156
<     my @codesign_args = ("/usr/bin/codesign", "--force", "--preserve-metadata=identifier,entitlements,resource-rules",
<                          "--sign", $opt{sign},
<                          "--resource-rules=$destApp/ResourceRules.plist");
---
>     my @codesign_args = ("/usr/bin/codesign", "--force", "--preserve-metadata=identifier,entitlements",
>                          "--sign", $opt{sign});
查看更多
登录 后发表回答