当前位置: 动力学知识库 > 问答 > 编程问答 >

ios - 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?

网友答案:

Executing xcodebuild is based on how you setup your project using Xcode. I am assuming here you've already done this.

Regarding background modes, you would also need to ensure that your Info.plist (or whatever you named it) contains UIBackgroundModes (this is the raw key) you want.

When you build via xcodebuild, all the proper info will get picked up, provided your project is setup properly.

More info on background execution is here: https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html

网友答案:

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">
<dict>
    <key>teamID</key>
    <string>734KHEMHW2</string>
    <key>method</key>
    <string>development</string>
    <key>uploadSymbols</key>
    <true/>
</dict>
</plist>

With my corresponding team ID found on http://developer.apple.com.

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: