生成用于iOS模拟器安装的包 发表于 2018-01-23 | 分类于 工具 | 12# 查看打的包的架构类型lipo -info myProject.app/myProject 12345678910111213141516171819202122232425262728293031323334353637383940# 切到项目目录cd myProject# 定义一下要用的变量Poj_Path=`pwd`Build_Sim=$Poj_Path/build/build-Sim/# 清除每次编译结果rm -rf build/derived/Build/# 使用xcodebuild命令编译用于simulator的*.app包(Release)# 由于推送sdk没有支持模拟器所以要设置ONLY_ACTIVE_ARCH=YESxcodebuild ONLY_ACTIVE_ARCH=YES -workspace "myProject.xcworkspace" -scheme "myProject" -configuration Release -sdk iphonesimulator -derivedDataPath "build/derived"if [[ $? -ne 0 ]]; then echo "编译失败" exit 1;fi# 到*.app目录cd derived/Build/Products/Release-iphonesimulator# 利用/usr/libexec/PlistBuddy获取现在的版本号BUILD_VER=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" myProject.app/Info.plist)BUILD_CODE=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" myProject.app/Info.plist)echo $BUILD_VER '_' $BUILD_CODE# 建一个文件目录mkdir $Build_Sim# 压缩*.app文件到Build_Sim目录下zip -r $Build_Sim/myProject.app.zip myProject.appif [[ $? -ne 0 ]]; then echo "压缩失败" exit 1;fiecho "build simulator product success!"exit 0;