1打开xcode commond + shift +n
2 设置Build Setting参数将Build Active Architecture only设置为NO
3.设置Build Setting参数在Architectures下增加armv7s
5.Mach-O Type:这里有好几种类型,我们需要选中static library
6.设置Headers,将要公开的头文件拖到Public下,要隐藏的放到Private或Project下,隐藏的头文件不能被引用,
7导入头文件
8.下面把这段脚本复制进去(格式不要错,格式错编译不通过)用于合并真机和虚拟机的包用
if["${ACTION}"="build"]
then
INSTALL_DIR=${SRCROOT}/Products/${PROJECT_NAME}.framework
DEVICE_DIR=${BUILD_ROOT}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework
SIMULATOR_DIR=${BUILD_ROOT}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework
if[ -d"${INSTALL_DIR}"]
then
rm -rf"${INSTALL_DIR}"
fi
mkdir -p"${INSTALL_DIR}"
cp -R"${DEVICE_DIR}/""${INSTALL_DIR}/"
#ditto "${DEVICE_DIR}/Headers" "${INSTALL_DIR}/Headers"
lipo -create"${DEVICE_DIR}/${PROJECT_NAME}""${SIMULATOR_DIR}/${PROJECT_NAME}"-output"${INSTALL_DIR}/${PROJECT_NAME}"
#open "${DEVICE_DIR}"
open"${SRCROOT}/Products"
fi
10 最后编译,command + B,编译通过在finder中找到framework
11 生成后的framework直接拖入项目然后再需要用的地方导入例如
网友评论