iOS App 打包

#iOS

whck6

自動打包這件事情,在很多時候可以幫助開發者,節省很多的等待時間。簡單來說就是開始執行你就可以不用管了,之後的產出甚至可以結合自動測試與發布等。

Archive

xcodebuild -workspace ${PROJECT_NAME}.xcworkspace \
  -scheme ${TARGET_NAME} \
  -sdk iphoneos \
  -configuration archive \
  -archivePath $PWD/build/${TARGET_NAME}.xcarchive

Export IPA

xcodebuild -exportArchive \
  -archivePath $PWD/build/${TARGET_NAME}.xcarchive \
  -exportOptionsPlist BUILD.plist \
  -exportPath $PWD/build

BUILD.plist

cat BUILD.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>teamID</key>
        <string>${TEAM_ID}</string>
        <key>method</key>
        <string>${METHOD}</string>
        <key>uploadSymbols</key>
        <true/>
        <key>compileBitcode</key>
        <true/>
</dict>
</plist>

method: (String) The method of distribution, which can be set as any of the following:
    app-store
    enterprise
    ad-hoc
    development
teamID: (String) The development program team identifier.
uploadSymbols: (Boolean) Option to include symbols in the generated ipa file.

https://gist.github.com/whck6/b1d12e06844cbf08ae7dfa088e306fad