Build iOS app and distribute .ipa via TestFlight w

2019-02-11 00:26发布

问题:

Apple has released Xcode 7 update that broke everything again.

Previously, we had to deal with

ResourceRules.plist: cannot read resources

issue by using a hack described, for example, here. Some people wonder why has this even happened in the first place.

However, with Xcode 7 update they forbade the usage of Code Signing Resource Rules Path by giving this error when this option is set:

ERROR ITMS-90339: "This bundle is invalid. The Info.plist contains an invalid key 'CFBundleResourceSpecification' in bundle

This question is exactly about this issue with an answer proposing to delete this option from build settings. Guess what, after deletion the first error pops up, so we find ourselves in the loop.

My question (apart from how come we've ended up in this mess, of course) is:

How do we fix both problems so iOS building works in Jenkins and Xcode 7 with TestFlight uploading afterwards?

回答1:

Take a look at this: https://stackoverflow.com/a/32762413/5373468

And if you're not sure it's a bug, you can get a confirmation here too: http://cutting.io/posts/packaging-ios-apps-from-the-command-line/



回答2:

As of Xcode 7 we should use xcodebuild instead of PackageApplication to produce the .ipa file.

xcodebuild has a new -exportArchive option to create an .ipa that works more like Xcode Organizer.

See answer here for details: iOS builds / ipa creation no longer works from the command line



回答3:

I fixed the same issue by changing Jenkins build settings: Go to Configure > Advanced Xcode build options and add to Custom xcodebuild arguments

CODE_SIGN_RESOURCE_RULES_PATH=$(SDKROOT)/ResourceRules.plist



回答4:

These two commands have worked perfectly for me:

  1. Create an archive: xcodebuild -workspace "/path/to/something.xcworkspace" -scheme "some enterprise" -configuration Release -CODE_SIGN_IDENTITY="your identity" PROVISIONING_PROFILE="61xyz111-22x0-2345-123x-xyxxxxxx" archive -archivePath "/where/you/want/the/archive/xyz.xcarchive"

  2. Generate IPA: xcodebuild -exportArchive -exportFormat IPA -exportProvisioningProfile "Name of your profile" -archivePath "/where/you/saved/the/archive/xyz.xcarchive" -exportPath "/where/you/want/the/IPA/xyz.ipa"