iOS在生成framework时需要在真机下编译一次并在模拟器下编译一次
编译后还需要合并两个framework 手动进行如果一直在调试会很麻烦
现在给出自动化解决方案:加入编译脚本(关于如何打包苹果framework包我就不做具体描述了)
以JGProgressHUD为例:
1.如下图1.1所示:在根目录下新建auto_farmeWork.sh的脚本文件和FrameWork的生成脚本后的输出文件夹
1.12.找到bulid Phases,新建Run Script Phase,如下图1.2所示:
1.23.添加如下图1.3脚本代码:
1.3具体代码:
TDIR=${PROJECT_DIR}FrameWork
cd"${TDIR}"
sh auto_frameWork.sh
4.项目切换到release模式然后分别在模拟器和真机各运行一下,在FrameWork文件夹下就会生成二合一的framework包了,如下图1.4所示:
1.4具体shell脚本代码如下:
#!/bin/shbundleID=${PRODUCT_BUNDLE_IDENTIFIER}
CURRENTCONFIG_DEVICE_DIR=${BUILD_DIR}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}
JfBuildDir=${BUILD_DIR}
JfExecutablePath=${EXECUTABLE_PATH}
JfExecutableName=${EXECUTABLE_NAME}
JfExecutableFolderPath=${EXECUTABLE_FOLDER_PATH}
echo "JfBuildDir =$JfBuildDir"
echo "JfExecutablePath =$JfExecutablePath"
echo "JfExecutableName =$JfExecutableName"
echo"90-> ${CURRENTCONFIG_DEVICE_DIR}"
cd${JfBuildDir}
framework="SDKTest"
[ -f"$framework"] && rm"$framework"
dire="FrameWork/"
[ -d"$dire"] && rm -rf"$dire"
mkdir"$dire"
if [ -d "Release-iphoneos" ] && [ -d "Release-iphonesimulator" ]; then
echo "composition framework"
lipo -create Release-iphoneos/${JfExecutablePath} Release-iphonesimulator/${JfExecutablePath} -output ${JfExecutableName}
cp -rf Release-iphoneos/* ${dire}
cp -f ${JfExecutableName} ${dire}/${JfExecutableFolderPath}
rm -f ${JfExecutableName}
open ${dire}
fi
网友评论