很快乐之前写的iOS测验包分发又有了新版本。这版本是去除了服务器装备,直接运用http://fir.im来做文件存储。
相关代码在github上也放了份,有爱好能够star下https://github.com/qdvictory/EasyToMore
xcode中增加run script,仿制一切代码。只需修正一下icon地址就能够了。
由于常常完善功用,代码有所改动,主张前往github检查最新代码
#/bin/sh
# Date: 2013-06-20
# Author: Seamus
# Sina Weibo: @qdvictory
# compress application.
if [ ${CONFIGURATION} = Debug ]; then
############################开发者装备#################################
#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 ${d}| ruby -e require ‘rubygems’; require ‘json’; puts JSON[STDIN.read][‘postFile’];`
postIcon=`echo ${d}| ruby -e require ‘rubygems’; require ‘json’; puts JSON[STDIN.read][‘postIcon’];`
shorturl=`echo ${d}| 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上传完结。仿制地址即可下载。\nhttp://fir.im/’${short}’ with title IPA一键共享 buttons {ok})’`
#删去临时文件
rm -R $CONFIGURATION_BUILD_DIR/Payload
rm ${ipaname}.ipa
fi
exit 0
装备完结后,编译,OK。