###之前网上所看到的打包脚本,需要设置的参数太多,脚本里面需要关心的参数太多
####网上查到的方法
- xcodebuild an app
- /usr/bin/xcrun -sdk iphoneos PackageApplication -v “${APP_DIR}/${TARGET_NAME}.app” -o “${IPA_DIR}/${TARGET_NAME}.ipa” –sign “${DEVELOPPER_NAME}” –embed “${PROVISONNING_PROFILE}”
需要设定
- BUILD_DIR
- 指定开发者名称
- 指定描述文件路径
#####在更换描述文件或者开发者名称的时候稍显难受,全程在想打包在哪里
###发现用xcodebuild(xctool) archive
和 xcodebuild -exportArchive
设置更简单够傻瓜,可以减少我的痛苦
####新方法
- xctool archive -archivePath “$ARCHIVE_PATH”
- xcodebuild -exportArchive -exportFormat ipa -archivePath “$ARCHIVE_PATH” -exportPath “$IPA_PATH” -exportProvisioningProfile $PROFILE
需要设定
- BUILD_DIR
- 描述文件名称
##脚本
#!/bin/sh
UPLOAD_SERVER="http://ryans-macbook-air.local/appstore/app/upload/"
function build() {
APP_NAME="EggOrder"
SCHEME="EggOrder"
BUILD_DIR=$(pwd)/Build # build目录
XCWORKSPACE="client_eggorder_5.xcworkspace"
DATE=`date +%y.%m.%d`
SHORT_CONF=$1
if [ "$SHORT_CONF" = "R" ] || [ "$SHORT_CONF" = "r" ] || [ "$SHORT_CONF" = "Release" ] ; then
CONF="Release"
else
CONF="Debug"
fi
ARCHIVE_PATH="$BUILD_DIR/$APP_NAME-$CONF-$DATE.xcarchive"
IPA_PATH="$BUILD_DIR/$APP_NAME-$CONF-$DATE.ipa"
PROFILE="eggorder"
#clean
rm -rf $ARCHIVE_PATH
rm -rf $IPA_PATH
xctool -workspace $XCWORKSPACE -scheme $SCHEME -configuration $CONF archive -archivePath "$ARCHIVE_PATH"
xcodebuild -exportArchive -exportFormat ipa -archivePath "$ARCHIVE_PATH" -exportPath "$IPA_PATH" -exportProvisioningProfile $PROFILE
echo "Uploading to Server...."
curl --form ipa_path="@$IPA_PATH" $UPLOAD_SERVER
echo "Done”
}
build $1