Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix Xcode 6.1 error while building IPA

People also ask

How do I fix Xcode?

Conversation. Xcode tip #5: If you have a Swift file with many errors, you can use Xcode's fix-its to try to correct them one by one. But a faster way is to go to the Editor menu and choose Fix All Issues to apply fix-its all at once. (Make sure and double-check which changes were made!)

What is Xcode error?

Xcode complains that a method of some class doesn't exist If you run your app and you get some build errors, that means Xcode has detected that the syntax of your code is wrong.


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


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});

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.


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.


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