一、打開一個 terminal 窗口,進入到 xcode 工程文件所在目錄,對於 cocos 工程需要進入到 proj.ios_mac 目錄
二、執行 xcodebuild clean 進行清除
三、執行 xcodebuild archive -scheme "NewCocosProject1-mobile" -configuration "Release" -archivePath "/Users/zhangzhenyu/Desktop/1.xcarchive"
其中 scheme 參數需要對應到工程 mobile target 名稱,configuration 爲固定的 Release,archivePath 指定導出的 .xcarchive 文件的位置
四、執行 xcodebuild -exportArchive -archivePath "/Users/zhangzhenyu/Desktop/1.xcarchive" -exportPath "/Users/zhangzhenyu/Desktop/4.ipa" -exportFormat IPA -exportProvisioningProfile "XC: *"
其中 archivePath 跟上個命令參數對應,exportPath 爲導出 ipa 文件的目錄,exportForma IPA爲固定值,exportProvisioningProfile 是 provisioning profile 的名稱,與創建工程時所選的 provisioning profile 有關
參考: