iOS開發(fā)包一鍵分發(fā)fir.im版,無需配置服務(wù)器,零成本
很高興之前寫的iOS測試包分發(fā)又有了新版本。這版本是去除了服務(wù)器配置,直接使用http://fir.im來做文件存儲。
相關(guān)代碼在github上也放了份,有興趣可以star下https://github.com/qdvictory/EasyToMore
xcode中添加run script,復(fù)制所有代碼。只要修改一下icon地址就可以了。
因為經(jīng)常完善功能,代碼有所改動,建議前往github查看最新代碼
#/bin/sh
# Date: 2013-06-20
# Author: Seamus
# Sina Weibo: @qdvictory
# compress application.
if [ "${CONFIGURATION}" = "Debug" ]; then
############################開發(fā)者配置#################################
#icon地址(相對于項目根目錄)
pathtoartwork="iFurniture/icon/120.png"
#####################################################################
#獲取app名
ipaname=`/usr/libexec/PlistBuddy -c "Print :CFBundleDisplayName $REV" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"`
#獲取版本號
version=`/usr/libexec/PlistBuddy -c "Print :CFBundleVersion $REV" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"`
#appid
appid=`/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier $REV" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"`
#打包.ipa
/bin/mkdir $CONFIGURATION_BUILD_DIR/Payload
/bin/cp -R $CONFIGURATION_BUILD_DIR/${ipaname}.app $CONFIGURATION_BUILD_DIR/Payload
/bin/cp ${pathtoartwork} $CONFIGURATION_BUILD_DIR/iTunesArtwork
cd $CONFIGURATION_BUILD_DIR
# zip up the Instasoccer directory
/usr/bin/zip -r ${ipaname}.ipa Payload iTunesArtwork
#fir.im上傳第一步
d=`curl "http://fir.im/api/upload_url?appid="${appid}`
#fir.im上傳第二步
postFile=`echo $p7pvf4p| ruby -e "require 'rubygems'; require 'json'; puts JSON[STDIN.read]['postFile'];"`
postIcon=`echo $czlnh92| ruby -e "require 'rubygems'; require 'json'; puts JSON[STDIN.read]['postIcon'];"`
shorturl=`echo $dnacqqd| ruby -e "require 'rubygems'; require 'json'; puts JSON[STDIN.read]['short'];"`
curl -T ${ipaname}.ipa ${postFile} -X PUT
curl -T $CONFIGURATION_BUILD_DIR/iTunesArtwork ${postIcon} -X PUT
#fir.im上傳第三步
postData='appid='${appid}'&short='${shorturl}'&version='${version}'&name='${ipaname}
r=`curl -X POST -d ${postData} -H "Content-Type: application/x-www-form-urlencoded; charset=utf-8" "http://fir.im/api/finish"`
short=`echo ${r}| ruby -e "require 'rubygems'; require 'json'; puts JSON[STDIN.read]['short'];"`
#輸出url
`osascript -e 'tell app "System Events" to (display dialog "恭喜您,IPA上傳完成。復(fù)制地址即可下載。\nhttp://fir.im/'${short}'" with title "IPA一鍵分享" buttons {"ok"})'`
#刪除臨時文件
rm -R $CONFIGURATION_BUILD_DIR/Payload
rm ${ipaname}.ipa
fi
exit 0
配置完成后,編譯,OK。