xcode 8.1web
swift 3.0swift
注:補充一下swift的訪問控制的關鍵字xcode
fileprivate :如名字同樣,只有這個文件才能訪問.app
private: 只能在做用域訪問.iphone
interal: 默認,在整個模塊能夠訪問.ui
public: 在模塊裏面是能夠繼承或者重寫,在模塊外能夠訪問,但不能夠重寫和繼承.spa
open:在全部模塊均可以訪問,重寫和繼承.3d
open> public > interal > fileprivate > privatecode
注: 引入動態庫的時候,須要在工程配置嵌入動態庫,否則的話會報錯blog
若是工程是oc工程的話,還須要在build Setting裏面配置一個選項爲YES,不然也是運行報錯
分別用真機和模擬器build,右鍵選擇打開framework的目錄,會發現有兩個release版本的framework.
使用 lipo 命令合併兩個版本的framework.
lipo -create ./Release-iphonesimulator/myFramework.framework/myFramework ./Release-iphoneos/myFramework.framework/myFramework -output ./myFramework
而後任意拷貝一份其中一個版本的framework替換調剛剛合併的文件便可.
FMK_NAME=myFramework INSTALL_DIR=${SRCROOT}/Products/${FMK_NAME}.framework WRK_DIR=build DEVICE_DIR=${WRK_DIR}/Release-iphoneos/${FMK_NAME}.framework SIMULATOR_DIR=${WRK_DIR}/Release-iphonesimulator/${FMK_NAME}.framework xcodebuild -configuration "Release" -target "${FMK_NAME}" -sdk iphoneos clean build xcodebuild -configuration "Release" -target "${FMK_NAME}" -sdk iphonesimulator clean build if [ -d "${INSTALL_DIR}" ] then rm -rf "${INSTALL_DIR}" fi mkdir -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}"