文章目录
.framework静态库文件
静态库项目编译后分别输出了真机和模拟器的库文件,我写了个简单的脚本在编译后自动合并真机和模拟器库文件。:
在build phase中添加runscript。脚本如下:
# define output folder environment variable
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# touch. copy the RKBluetoothLE_iOS.framework. Just for convenience
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/RKBluetoothLE_iOS.framework" "${UNIVERSAL_OUTPUTFOLDER}/"
# Create universal binary file using lipo
lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/RKBluetoothLE_iOS.framework/RKBluetoothLE_iOS" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/RKBluetoothLE_iOS.framework/RKBluetoothLE_iOS" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/RKBluetoothLE_iOS.framework/RKBluetoothLE_iOS"
cmd+B,搞定。
在products/Debug-universal文件夹中找到生成的通用库。
用lipo查看. framework库所支持的架构。
lipo -info RKBluetoothLE_iOS
Architectures in the fat file: RKBluetoothLE_iOS are: x86_64 armv7 arm64