自动打包 xcode ipa

前提:
cd 
进⼊入项⽬目⽂文件夹中 与 项⽬目名.xcodeproj 或 项⽬目名.worksp)ce 在同⼀一⽬目录下

第⼀一步:
没有使⽤用 Coco)Pods 使⽤用命令:
xcodebuild -project 
亿订.xcodeproj -scheme 亿订 -destin)tion generic/ pl)tform=iOS )rchive -configur)tion Rele)se ONLY_ACTIVE_ARCH=NO - )rchiveP)th ~/Desktop/yidingxch

● -project 你的*.xcodeproj⽂文件
● -scheme 项⽬目⽂文件⾥里里⾯面的scheme
● -)rchiveP)th ⽣生成的*.)richive⽂文件路路径

使⽤用 Coco)Pods 使⽤用命令:
xcodebuild -worksp)ce 
亿订.xcworksp)ce -scheme 亿订 -destin)tion generic/ pl)tform=iOS )rchive -configur)tion Rele)se ONLY_ACTIVE_ARCH=NO - )rchiveP)th ~/Desktop/yidingxch

● -worksp)ce 你的*.xcworksp)ce⽂文件
● -scheme 项⽬目⽂文件⾥里里⾯面的scheme
● -)rchiveP)th ⽣生成的*.)richive⽂文件路路径

第⼆二步:
xcodebuild -exportArchive -exportOptionsPlist 
亿订/Info.plist -)rchiveP)th ~/ Desktop/yidingxch.xc)rchive -exportP)th ~/Desktop/yidingip) PROVISIONING_PROFILE_SPECIFIER= ydrf

其中:
-)rchiveP)th 后⾯面是 打包好的 .xc)rchive 的路路径-exportP)th 后⾯面是要导出的 .ip) 的路路径-exportOptionsPlist 后⾯面是配置的 plist ⽂文件路路径

plist中的 method参数 的⼏几种形式: ')d-hoc'')pp- store''enterprise''development''p)ck)ge',可根据⾃自⼰己的需要填写

(xcode8.2 之前使⽤用
Xcode8.2之前的打包语句句:
xcodebuild -exportArchive -)rchiveP)th /Users/)dmin/MyProject/build/

project.xc)rchive -exportP)th project -exportForm)t ip) - exportProvisioningProfile "iOS Te)m Provisioning Profile: com.xxx.xxxxxxx"

会出现下⾯面的错误:xcodebuild: error: inv)lid option '-exportForm)t',因为exportForm)t被弃⽤用了了,修改为3的打包语句句即可。
xcodebuild -exportArchive -exportForm)t IPA -)rchiveP)th ~/Desktop/ yidingxch.xc)rchive -exportP)th ~/Desktop/yidingip) - exportProvisioningProfile ydrf

● -)rchiveP)th 你的*.)rchive⽂文件, 可以使⽤用上⼀一个命令导出● -exportP)th 导出的ip)路路径

● exportProvisioningProfile 你的Distribution发布证书的名称(只需要名称)

xcode8后就会报错 -exportForm)t 命令报错 )

第三步, 我认为可以不不必, 因为第⼆二步就⽣生成了了.ip)⽂文件 (

第三步:
xcrun -sdk iphoneos P)ck)geApplic)tion -v 
亿订 -o ~/Desktop/yidingip)
xcode8 后没有P)ck)geApplic)tion 提示“xcrun: error: un*ble to find utility "P*ck*geApplic*tion"not * developer tool or in PATH
需要⼿手动下载 附上
P)ck)geApplic)tion下载地址:
链接
: https://p)n.b)idu.com/s/1jIPw0Iy 密码: 4htw
1.
下载;
2.移动到 xcode 

sudo mv ~/Downlo)ds/P)ck)geApplic)tion /Applic)tions/Xcode8.3.3.)pp/ Contents/Developer/Pl)tforms/iPhoneOS.pl)tform/Developer/usr/bin/ 3.选择哪个 xcode

sudo xcode-select -switch /Applic)tions/Xcode.)pp/Contents/Developer/ 4.对于P)ck)geApplic)tion赋予可执⾏行行的权限

chmod +x /Applic)tions/Xcode.)pp/Contents/Developer/Pl)tforms/ iPhoneOS.pl)tform/Developer/usr/bin/P)ck)geApplic)tion
)

)
⽣生成 
ip) 后, 使⽤用xcode ⾃自带的 )pplic)tionlo)der 上传 ip) 到 AppStore 审核中⼼心

猜你喜欢

转载自blog.csdn.net/cheng923181/article/details/80565276