標籤:讀取 clean gets www. 參數 csdn car 方式 變數
之前咱們講過 使用命令列打包 下面咱們介紹使用指令碼打包,其實指令碼和命令列沒有太大的本質區別。
以下是指令檔:
#注意:指令碼目錄和xxxx.xcodeproj要在同一個目錄,如果放到其他目錄,請自行修改指令碼。#工程名字(Target名字)Project_Name="Target名字,系統預設和工程名字一樣"#配置環境,Release或者DebugConfiguration="Release"#AdHoc版本的Bundle IDAdHocBundleID="com.xxxxx"#AppStore版本的Bundle IDAppStoreBundleID="com.xxxxx"#enterprise的Bundle IDEnterpriseBundleID="com.xxxxx"# ADHOC#認證名#描述檔案ADHOCCODE_SIGN_IDENTITY="iPhone Distribution: xxxxx"ADHOCPROVISIONING_PROFILE_NAME="xxxxx-xxxx-xxxxx-xxxxx"#AppStore認證名#描述檔案APPSTORECODE_SIGN_IDENTITY="iPhone Distribution: xxxx"APPSTOREROVISIONING_PROFILE_NAME="xxxx-xxxx-xxxx-xxxx-xxxx"#企業(enterprise)認證名#描述檔案ENTERPRISECODE_SIGN_IDENTITY="iPhone Distribution: xxxx"ENTERPRISEROVISIONING_PROFILE_NAME="693bc1e0-7f7a-4fba-8a08-977ffb7fb296"#載入各個版本的plist檔案ADHOCExportOptionsPlist=./ADHOCExportOptionsPlist.plistAppStoreExportOptionsPlist=./AppStoreExportOptionsPlist.plistEnterpriseExportOptionsPlist=./EnterpriseExportOptionsPlist.plistADHOCExportOptionsPlist=${ADHOCExportOptionsPlist}AppStoreExportOptionsPlist=${AppStoreExportOptionsPlist}EnterpriseExportOptionsPlist=${EnterpriseExportOptionsPlist}echo "~~~~~~~~~~~~選擇打包方式(輸入序號)~~~~~~~~~~~~~~~"echo "1 appstore"echo "2 adhoc"echo "3 enterprise"# 讀取使用者輸入並存到變數裡read parametersleep 0.5method="$parameter"# 判讀使用者是否有輸入if [ -n "$method" ]then#clean下xcodebuild clean -xcodeproj ./$Project_Name/$Project_Name.xcodeproj -configuration $Configuration -alltargets if [ "$method" = "1" ] then#appstore指令碼xcodebuild -project $Project_Name.xcodeproj -scheme $Project_Name -configuration $Configuration -archivePath build/$Project_Name-appstore.xcarchive clean archive build CODE_SIGN_IDENTITY="${APPSTORECODE_SIGN_IDENTITY}" PROVISIONING_PROFILE="${APPSTOREROVISIONING_PROFILE_NAME}" PRODUCT_BUNDLE_IDENTIFIER="${AppStoreBundleID}"xcodebuild -exportArchive -archivePath build/$Project_Name-appstore.xcarchive -exportOptionsPlist $AppStoreExportOptionsPlist -exportPath ~/Desktop/$Project_Name-appstore.ipa elif [ "$method" = "2" ] then#adhoc指令碼xcodebuild -project $Project_Name.xcodeproj -scheme $Project_Name -configuration $Configuration -archivePath build/$Project_Name-adhoc.xcarchive clean archive build CODE_SIGN_IDENTITY="${ADHOCCODE_SIGN_IDENTITY}" PROVISIONING_PROFILE="${ADHOCPROVISIONING_PROFILE_NAME}" PRODUCT_BUNDLE_IDENTIFIER="${AdHocBundleID}"xcodebuild -exportArchive -archivePath build/$Project_Name-adhoc.xcarchive -exportOptionsPlist $ADHOCExportOptionsPlist -exportPath ~/Desktop/$Project_Name-adhoc.ipa elif [ "$method" = "3" ] then#企業打包指令碼xcodebuild -project $Project_Name.xcodeproj -scheme $Project_Name -configuration $Configuration -archivePath build/$Project_Name-enterprise.xcarchive clean archive build CODE_SIGN_IDENTITY="${ENTERPRISECODE_SIGN_IDENTITY}" PROVISIONING_PROFILE="${ENTERPRISEROVISIONING_PROFILE_NAME}" PRODUCT_BUNDLE_IDENTIFIER="${EnterpriseBundleID}"xcodebuild -exportArchive -archivePath build/$Project_Name-enterprise.xcarchive -exportOptionsPlist $EnterpriseExportOptionsPlist -exportPath ~/Desktop/$Project_Name-enterprise.ipaelse echo "參數無效...." exit 1 fifi
其中AppStore認證名、描述檔案參考 認證(Certificate)與描述檔案(Provisioning Profiles)
參考文檔
54144149
IOS使用批處理打包