Reputation: 2687
I'm trying to build an IOS app from the command line instead of through Xcode it's been an uphill struggle. My project builds fine in Xcode by going to Product -> Archive, but when I try to do what I think is the same thing in the Terminal with xcodebuild
, it fails due to some missing header files.
How do I find out what actually happens when I click Archive?
Alternatively, if anyone can spot where my error is, the command I think should be working is:
xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -configuration Beta -destination 'generic/platform=iOS' -archivePath <path to xcarchive file> archive
Upvotes: 1
Views: 2818
Reputation: 1026
Hi I have a guess because I could not find the actual documentation. I have a small script that works for deployment directly on the App Store using my private keys. I'm sharing with you if it can helps, I'm asking you to accept the answer.
#clean and build
xcodebuild -workspace ./my-app.xcworkspace/ -scheme my-app -sdk iphonesimulator12.0 clean # analyze
xcodebuild -workspace ./my-app.xcworkspace/ -scheme my-app -destination generic/platform=iOS build
#archive
xcodebuild -workspace ./my-app.xcworkspace/ -scheme my-app -sdk iphoneos -configuration AppStoreDistribution archive -archivePath $PWD/build/my-app.xcarchive
# create build ipa
xcodebuild -exportArchive -archivePath $PWD/build/my-app.xcarchive -exportOptionsPlist exportOptions.plist -exportPath $PWD/build
# /Applications/Xcode.app/Contents/Applications/Application\ Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool
# upload app for testflight
export USERNAME=myusername
export PASSWORD=mypassword
# password is generated at appleid.apple.com
cd build
altool --upload-app -f "my-app.ipa" -u $USERNAME -p $PASSWORD
https://medium.com/xcblog/xcodebuild-deploy-ios-app-from-command-line-c6defff0d8b8
You mentioned that your app fails because of header files, I'm suggesting that you check this out because it can be a pain in the ... sometimes. By the way my app has some native headers too.
Upvotes: 6