iOS命令行打包

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改写下面的内容就行





    compileBitcode
    
    provisioningProfiles
    
            bundleID
            开发者中心对应的发布PP文件名
    
    method
    ad-hoc
    signingStyle
    automatic
    stripSwiftSymbols
    
    teamID
    项目ID
    thinning
    <none>



打包时如果提示命令找不到,可以先执行如下:

# 切换到xcode当前目录
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
 xcodebuild -showsdks
xcrun --sdk iphoneos --show-sdk-path

你可能感兴趣的:(iOS命令行打包)