iOS 创建Framework
a 搜Linking 调整 Mach-O Type并 改为 Static Library【静态库】
Build Active Architecture Only意思是: 该编译项用于设置是否只编译当前使用的设备对应的arm指令集
当该选项设置成YES时,你连上一个armv7指令集的设备,就算你的Valid Architectures和Architectures都设置成armv7/armv7s/arm64,还是依然只会生成一个armv7指令集的二进制包
Release模式为发布模式,需要支持各种设备指令集,所以设置为NO
Dead Code Stripping, 设置为 NO 关闭对代码中“dead”,“unreachable”代码过滤
Link With Standard Libraries 设置为 NO 避免重复链接
Build 环境 设置build环境为release环境下
d defines Module 改为NO
e build active architecture only 改为NO,编译所有版本类型
合并脚本
# Sets the target folders and the final framework product.# 如果工程名称和Framework的Target名称不一样的话,要自定义FMKNAME# 例如: FMK_NAME = "MyFramework"FMK_NAME=${PROJECT_NAME}# Install dir will be the final output to the framework.# The following line create it in the root folder of the current project.INSTALL_DIR=${SRCROOT}/Products/${FMK_NAME}.framework# Working dir will be deleted after the framework creation.WRK_DIR=buildDEVICE_DIR=${WRK_DIR}/Release-iphoneos/${FMK_NAME}.frameworkSIMULATOR_DIR=${WRK_DIR}/Release-iphonesimulator/${FMK_NAME}.framework# -configuration ${CONFIGURATION}# Clean and Building both architectures.xcodebuild -configuration"Release"-target"${FMK_NAME}"-sdk iphoneos clean buildxcodebuild -configuration"Release"-target"${FMK_NAME}"-sdk iphonesimulator clean build# Cleaning the oldest.if[-d"${INSTALL_DIR}"]thenrm -rf"${INSTALL_DIR}"fimkdir -p"${INSTALL_DIR}"cp -R"${DEVICE_DIR}/""${INSTALL_DIR}/"cp -R"${SIMULATOR_DIR}/""${INSTALL_DIR}/"# Uses the Lipo Tool to merge both binary files (i386 + armv6/armv7) into one Universal final product.lipo -create"${DEVICE_DIR}/${FMK_NAME}""${SIMULATOR_DIR}/${FMK_NAME}"-output"${INSTALL_DIR}/${FMK_NAME}"rm -r"${WRK_DIR}"open"${INSTALL_DIR}"