背景小介紹
- xcodebuild xcode 提供的命令行工具,用于build 工程或者工作空間,具體的用法可以在終端中輸入 man xcodebuild.本次我們主要使用
xcodebuild [-project name.xcodeproj] [[-target targetname] ... | -alltargets] [-configuration configurationname] [-sdk [sdkfullpath | sdkname]] [action ...] [buildsetting=value ...] [-userdefault=value ...]
*shenzhen 主要用于 ipa 包的提交,當(dāng)然他有很多功能更,這里我只用了一點(diǎn)點(diǎn)而已,更多的使用可以參見github 地址.
下面直接上命令了
生成 archive 文件
"xcodebuild -quiet -workspace XXX.xcworkspace -scheme XXXXX -sdk iphoneos -configuration Release archive -archivePath $PWD/build/XXXXX.xcarchive
- -quiet 讓控制臺(tái)盡量少的輸出日志
- -workspace XXX.xcworkspace 需要 build 的 workspace,不是必須參數(shù)
- -scheme XXXXX build 指定的 scheme, 如果是 build workspace那么這個(gè)參數(shù)是必須的
- -sdk [sdkfullpath | sdkname] Build an Xcode project or workspace against the specified SDK, using build tools appropriate for that SDK. The argument may be an absolute path to an SDK, or the canonical name of an SDK.
- -configuration configurationname Use the build configuration specified by configurationname when building each target.
- -archivePath -archivePath xcarchivepath Specifies the path for the archive produced by the archive action, or specifies the archive that should be exported when -exportArchive is passed.
這時(shí)候可以在./ build 文件夾下面看到 XXX.xcarchive 文件了
生成 ipa 包(這里利用的 shenzhen)
xcodebuild -quiet -exportArchive -archivePath $PWD/build/student_appstore.xcarchive -exportOptionsPlist exportOptions.plist -exportPath $PWD/build
- exportOptions.plist主要包含了
<dict>
<key>method</key>
<string>app-store</string>
<key>teamID</key>
<string>your tram id</string>
<key>uploadBitcode</key>
<false/>
</dict>
- 現(xiàn)在可以在./ build 文件夾看到了 XXX.ipa 包了
上傳 itunesConnect
ipa distribute:itunesconnect -a itunesConntect 賬號(hào) -p iTunesConnect 密碼 -i appId -f "$PWD/build/student_appstore.ipa --upload