用shell脚本解决繁琐的多渠道打包工作。
资料:http://c.biancheng.net/cpp/view/6994.html
代码:
#!/bin/sh
CONFIG_ROOT_PATH="/Users/metao/work/ios/haigou"
cd $CONFIG_ROOT_PATH
#循环数组
CHANNELID=("appstore""91助手""PP助手")
for((i=0;i<${#CHANNELID[@]};i++))
do
#删除
rm -rf"/Users/metao/work/ios/haigou/build/"
#清除
xcodebuild -target haigou clean
echo ${CHANNELID[$i]}
#修改plist
/usr/libexec/PlistBuddy -c"set :CHANNELID ${CHANNELID[$i]}"/Users/metao/work/ios/haigou/haigou/haigou-Info.plist
#打包
xcodebuild -target haigou -configuration Release -sdk iphoneos build
#生成ipa
xcrun -sdk iphoneos PackageApplication -v"/Users/metao/work/ios/haigou/build/Release-iphoneos/haigou.app"-o"/Users/metao/work/ipa/haigou_${CHANNELID[$i]}.ipa"
done
搞定,perfect!