xcodebuild -alltargets clean
首先進入到工程文件所在的目錄。比如我的文件某個工程放在(.xcodeproj文件所在的目錄) /Users/xxx/xxx 然后ce /Users/xxx/xxx 到這個目錄下 第一步先編譯生成testDemo.xcarchive 文件。 xcodebuild -archivePath "testDemo.xcarchive" -project PcAppleSdkDemo.xcodeproj -sdk iphoneos -scheme "PcAppleSdkDemo" -configuration "Release Adhoc" archive //這里生成的testDemo.xcarchive文件目錄與.xcodeproj是同一目錄 //-archivePath 生成的.xcarchive 名字 //-project 目標文件名 //-scheme 項目的目標文件名 第二步把生成的testDemo.xcarchive文件打包成ipa 格式。 xcodebuild -exportArchive -exportFormat IPA -exportProvisioningProfile "qingyunDeveloper" -archivePath "testDemo.xcarchive" -exportPath "testDemo.ipa" 成功后顯示 ** EXPORT SUCCEEDED ** //這時的ipa 文件存放目錄與.xcodeproj是同一目錄 //-exportProvisioningProfile 這個是選擇的證書 你的證書名是什么這里就填寫什么。
//參考資料 : http://minhdanh2002.blogspot.jp/2014/06/archiving-ios-projects-from-command.html
//
這里會生成.app文件。然后用.app打包
xcodebuild -project PlaycoolSdkDemo.xcodeproj -sdk iphoneos
//xcodebuild -project Reporter.xcodeproj -scheme "InternalTest" -configuration "Release Adhoc" clean //xcodebuild -project Reporter.xcodeproj -sdk iphoneos -scheme "InternalTest" -configuration "Release Adhoc" //這里會生成.app文件。然后用.app打包 //xcrun -sdk iphoneos PackageApplication -v "Internaltest/TestApp.app" -o "InternalTestRelease.ipa" --sign \"iPhone Distribution: My Company Pte Ltd (XCDEFV)"
//如果證書在xcode 里正常設置好了。就按這種格式導出 // xcrun -sdk iphoneos PackageApplication -v /Users/chenqing/Sqy/iOSProject/Unity/TestUnityDemo1/build/ProductName.app -o /Users/chenqing/Sqy/iOSProject/Unity/TestUnityDemo1/uniii.ipa