Xcodebuild arguments ignored when using archive

My name is Luca, and I'm currently working on continuous iOS integration to create applications in xcode for distribution (Ad Hoc and App Store) using shell scripts.

So far, I have achieved good results using IPA files. My problem arises for distribution on the App Store. To build .app from a script (passing some arguments), I do:

xcodebuild -scheme myScheme -configuration myConfiguration PRODUCT_NAME=myProductName TARGETED_DEVICE_FAMILY=myTargetedDeviceFamily .... etc 

Since with XCode 4.2, applications are presented using the XCode Organizer window, I must also archive my executable.

Therefore, I modify the previous command line as follows:

 xcodebuild -scheme myScheme -configuration myConfiguration PRODUCT_NAME=myProductName TARGETED_DEVICE_FAMILY=myTargetedDeviceFamily .... etc **archive** 

Unfortunately, after that, it seems to me that the "archive" argument causes xcodebuild to ignore the others (PRODUCT_NAME, TARGETED_DEVICE_FAMILY, ....), and my output is built using the predefined Xcode build settings.

I want to be able to pass arguments using xcodebuild and be efficient, but the β€œarchive” action seems to prevent this.

I'm going crazy, help :)

thanks

+7
source share
3 answers

The archive action for xcodebuild is similar to the error in Xcode 4.2. Typically, overrides for project configuration can be specified either as command-line options or through the -xcconfig parameter.

Despite the fact that the assembly action distinguishes them, there is no archive. (Presumably, this is because the archive is a meta-action that calls the internal assembly but does not pass the parameters of the internal call.) There is an OpenRadar error that describes this problem, so it was allegedly reported by Apple.

Finally, note that if you intend to use the archive action from a script, then you cannot rely on the exit code from xcodebuild. Archive action always gives exit code 0 (success, by agreement). To detect build failures, you need to clear the output.

+4
source

I ran into this problem. My current job is basically deleting other configurations, so the archive is forced to use the one you want. Actually, this is not a solution that can be executed using the command line, I hope Apple solves this glaring problem.

0
source

It may be too late for the original poster, but may help others. for my build process, I use xcodebuild for the first cleanup and then for the build, then I use xcrun to create the archive:

  /usr/bin/xcrun -sdk iphoneos PackageApplication -v "build/<Path_to_build_dir>/<App_Name>.app" -o "<Path_to_archive_output>.ipa" --sign "<signing identity>" --embed "<path to provision profile>.mobileprovision" 

with this command, I can create an archive for the application store or even download a special assembly for TestFlight as follows:

 curl http://testflightapp.com/api/builds.json \ -F file="<path to archive>" \ -F api_token='<api token>' \ -F team_token='<team token>' \ -F notes='Automated build' \ -F notify=True \ -F distribution_lists='me' 

this works with xcode 6.1

-one
source

All Articles