iOS项目自动打包上传testflight(Shell)

Xcode打开项目勾选自动签名,设置Team和Bundle Identifier
等待Xcode自动下载安装Certificates和Provisioning Profile
确认mac里已经安装开发者证书Certificates和Provisioning Profile
打开[钥匙串访问>登陆>我的证书>Apple Development...]获取组织单位(teamID)
将下面代码保存为shell文件,修改配置参数后,放到项目根目录执行

# 配置打包参数
workspace="配置workspace文件名(project_name.xcworkspace)"
scheme="配置项目target名称(target_name)"
teamID="配置teamID"
# 配置上传参数
user="配置Apple ID"
pass="配置App-Specific Passwords"
# 清理项目
project_path=$(cd `dirname $0`; pwd)
cd $project_path
xcodebuild clean -workspace $workspace -scheme $scheme
# 创建xcarchive
archiveFilename=(`date +%Y_%m_%d_%H_%M_%S`)
package_dir="package"
mkdir $package_dir
archivePath="$project_path/$package_dir/$archiveFilename"
xcodebuild archive -workspace $workspace -scheme $scheme -archivePath $archivePath -configuration Release
# 创建ipa
cd $package_dir
exportOptionsPlist="ExportOptions.plist"
echo "<?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>generateAppStoreInformation</key>
    <false/>
    <key>manageAppVersionAndBuildNumber</key>
    <true/>
    <key>method</key>
    <string>app-store</string>
    <key>signingStyle</key>
    <string>automatic</string>
    <key>stripSwiftSymbols</key>
    <true/>
    <key>teamID</key>
    <string>$teamID</string>
    <key>uploadSymbols</key>
    <true/>
</dict>
</plist>
" > ${exportOptionsPlist}
xcodebuild -exportArchive -archivePath "$archivePath.xcarchive" -exportPath $archivePath -exportOptionsPlist $exportOptionsPlist
# 上传ipa
xcrun altool --upload-app -t ios -f $archivePath/*.ipa -u $user -p $pass
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
禁止转载,如需转载请通过简信或评论联系作者。

相关阅读更多精彩内容

友情链接更多精彩内容