user2010496 user2010496 - 1 year ago 190
iOS Question

How do I get XCode capabilities when building with xcodebuild?

I use Background Mode (voip) capabilities for my app in XCode. When I build the app through XCode with a provisioning profile that is allowed this capability - the app works. But then I build my iOS app from command-line in the following manner:

xcodebuild -workspace test.xcworkspace -scheme test -sdk iphoneos clean build archive -archivePath test.xcarchive
xcodebuild -exportArchive -archivePath test.xcarchive -exportPath acc exportFormat ipa

When building an ipa in this way and installing it on the iPhone the Background Mode voip isn't active in the app. How can I get the Background mode capability active when building through command-line with xcodebuild?

Answer Source

Apparently the "xcodebuild -exportArchive ..." line was deprecated without using the -exportOptionsPlist argument. So I created an options.plist in the same directory that looked like:

<plist version="1.0">

With my corresponding team ID found on

Then used the following line to export to ipa:

xcodebuild -exportArchive -exportOptionsPlist options.plist -archivePath test.xcarchive -exportPath .

And this successfully created the ipa with voip capabilities enabled.