iOS--命令行打包IPA包

非常重要

http://blog.sina.cn/dpool/blog/s/blog_5c91824f0102wdp0.html?vt=4
在打包过程中会出现profile文件错误,那是因为自动打包和xcode打包读取profile文件的位置不一样。
provisioning profile默认安装路径是:/Users/admin/Library/MobileDevice/Provisioning Profiles
xcodebuild获取provisioning profile路径是:/Library/MobileDevice/Provisioning Profiles
解决办法:将/Users/admin/Library/MobileDevice/Provisioning Profiles内容复制到/Library/MobileDevice/Provisioning Profiles

# 只需要更改应用名就可以
SCHEMENAME=iOSPushTest
BRANCHNAME=develop

# config
DATE=`date +%Y%m%d_%H%M`
echo "DATE=$DATE"
SOURCEPATH=$( cd "$( dirname $0 )" && pwd)
echo "工程目录是:$SOURCEPATH"
IPAPATH=$SOURCEPATH/AutoBuildIPA/$BRANCHNAME/$DATE
IPANAME=$SCHEMENAME_$DATE.ipa

# start build
xcodebuild \
-workspace $SOURCEPATH/$SCHEMENAME.xcodeproj/project.xcworkspace \
-scheme $SCHEMENAME \
-configuration Debug \
clean \
build \
-derivedDataPath $IPAPATH

if [ -e $IPAPATH ]; then
    echo "xcodebuild Successfil"
else
    echo "xcodebuild error"
    exit 1
fi

#xcrun .ipa
xcrun -sdk iphoneos PackageApplication \
    -v $IPAPATH/Build/Products/Debug-iphoneos/$SCHEMENAME.app \
    -o $IPAPATH/$IPANAME

if [ -e $IPAPATH/$IPANAME ]; then
    echo "----------------------------\n\n\n"
    echo "xcrun build Successful"
    echo "----------------------------\n\n\n"
else 
    echo "----------------------------\n\n\n"
    echo "xcrun build error"
    echo "----------------------------\n\n\n"
fi

将SCHEMENAME改为你自己的

注意点:

  1. 需要将scheme公开
iOS--命令行打包IPA包_第1张图片
Paste_Image.png

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