xcodebuild -project <XXX.xcodeproj所在路径> -archivePath <XXX.xcarchive所在路径> -scheme <Scheme名字> -configuration <Debug或Release> -sdk iphoneos archive DEVELOPMENT_TEAM="<TeamID>"
-project 指向xcode工程文件的路径
-archivePath 导出的归档的文件路径
-scheme 项目的scheme名字
-configuration 通常设置Debug或者Release
-DEVELOPMENT_TEAM 苹果开发者团队TEAMID
xcodebuild -project <XXX.xcodeproj所在路径> -archivePath <XXX.xcarchive所在路径> -scheme <Scheme名字> -configuration <Debug或Release> -sdk iphoneos archive DEVELOPMENT_TEAM="<TeamID>" CODE_SIGN_IDENTITY="<证书名字>" PROVISIONING_PROFILE_SPECIFIER="<描述文件名字>"
-project 指向xcode工程文件的路径
-archivePath 导出的归档的文件路径(包含文件夹和文件名)
-scheme 项目的scheme名字(xcode -> product -> scheme)
-configuration 通常设置Debug或者Release
-DEVELOPMENT_TEAM 苹果开发者团队TEAMID(在苹果开发者网站上查看teamid)
-CODE_SIGN_IDENTITY 证书名字(一定要去钥匙串里复制粘贴正确的证书名,注意包含前缀如iPhone Distribution: ,iPhone Developer:,全名如:iPhone Distribution: Jiangsu Qianmi Network Technology Co., Ltd.)
-PROVISIONING_PROFILE_SPECIFIER 描述文件的名字(苹果开发者网站,Provisioning Profiles对应的名称)
xcodebuild -exportArchive -archivePath <XXX.xcarchive所在路径> -exportPath <导出.ipa的路径> -exportOptionsPlist <XXX.plist所在路径>
-archivePath 导出的归档的文件路径
-exportPath 想要导出.ipa文件的路径
-exportOptionsPlist plist文件所在的位置(不是info.plist,这是xcode8.3后不支持-exportFormat命令后,改成用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>method</key>
<string>development<string>
</dict>
</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>method</key>
<string>app-store<string>
<key>teamID</key>
<string>你的苹果开发者团队ID<string>
</dict>
</plist>
参考文章看这里
#####examble########
生成归档文件 xxx.xcarchive
xcodebuild -project /Users/yclxiao/Project/elifehome/ios/elifehome.xcodeproj -archivePath /Users/yclxiao/Project/elifehome/ios/elifehome.xcarchive -scheme elifehome -configuration Release -sdk iphoneos archive DEVELOPMENT_TEAM="SFSFH6NHYB" CODE_SIGN_IDENTITY="iPhone Distribution: Jiangsu Qianmi Network Technology Co., Ltd." PROVISIONING_PROFILE_SPECIFIER="ehome"
生成ipa文件 xxx.ipa
xcodebuild -exportArchive -archivePath /Users/yclxiao/Project/elifehome/ios/elifehome.xcarchive -exportPath /Users/yclxiao/Project/elifehome/ios/elifehome.ipa -exportOptionsPlist /Users/yclxiao/Project/elifehome/ios/export.plist
export.plist的内容如下:
`
teamID XXXXXXX method enterprise compileBitcode uploadSymbols `