cd到项目目录下,执行如下命令:
clean:
xcodebuild clean -workspace 项目名.xcworkspace -scheme sechme名字
archive (configuration可选Release)
xcodebuild archive -workspace 项目名.xcworkspace -scheme sechme名字 -configuration Debug -archivePath ./BuildTest.xcarchive
生成ipa包,exportTest.plist需要提前准备好放在项目目录中
xcodebuild -exportArchive -archivePath BuildTest.xcarchive -exportPath ExportDestination -exportOptionsPlist 'exportTest.plist'
附:
exportTest.plist内容如下,可以先用xcode图形化界面打出一个包,里面会自带plist文件,仿照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>compileBitcode</key>
<false/>
<key>provisioningProfiles</key>
<dict>
<key>bundleID</key>
<string>开发者中心对应的发布PP文件名</string>
</dict>
<key>method</key>
<string>ad-hoc</string>
<key>signingStyle</key>
<string>automatic</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>项目ID</string>
<key>thinning</key>
<string><none></string>
</dict>
</plist>
打包时如果提示命令找不到,可以先执行如下:
# 切换到xcode当前目录
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
xcodebuild -showsdks
xcrun --sdk iphoneos --show-sdk-path
网友评论