注意事項
- 是否僅構(gòu)建活動架構(gòu),設(shè)置為No,即不僅只編譯當(dāng)前所選架構(gòu)。
-
Build Active Architecture Only
Build Active Architecture Only.png
-
- 設(shè)置 Framework 為靜態(tài)庫類型
-
Mach-O Type
Mach-O Type.png -
設(shè)置 Framework 為分發(fā)而構(gòu)建,對于Swift,支持Swift標(biāo)準(zhǔn)庫的演變和模塊接口文件的生成,即提供給他人使用時,Xcode中Swift版本向下兼容,轉(zhuǎn)換 xcframework 需要設(shè)置為YES。
-
Build Libraries for Distribution
Build Libraries for Distribution.png
-
-
是否啟用死代碼剝離,即編譯選項優(yōu)化,對于制作Framework,
應(yīng)該設(shè)置為No, 不啟用代碼剝離。-
Dead Code Stripping
Dead Code Stripping.png
-
-
移除模擬器中生成的arm64架構(gòu),非必須操作,模擬器 arm64 與真機(jī)arm64 類型不一樣,
arm64-apple-ios-simulator、arm64-apple-ios-
Excluded Architecture
Excluded Architecture.png
-
-
校驗
podspec文件
-
cd 至
ScanHelper.podspec文件根目錄- 本地校驗
ScanHelper.podspec文件內(nèi)容規(guī)范性
pod lib lint --verbose --allow-warnings --skip-import-validation- 聯(lián)網(wǎng)校驗遠(yuǎn)程組件倉庫tag版本與本地待發(fā)布版本tag一致性
pod spec lint --verbose --allow-warnings --skip-import-validation- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.- 若工程中依賴
私有靜態(tài)庫,則需要 追加--skip-import-validation指令
--skip-import-validation- 注冊賬戶,可以追加一些描述信息
pod trunk register+郵箱+用戶名+可選指令
Trunk帳戶沒有密碼,只有每臺計算機(jī)的token令牌pod trunk register it@xxxx.com 'Charlie' --description='macbook pro'- 點(diǎn)擊上述
郵件中鏈接,隨后執(zhí)行如下指令進(jìn)行校驗,并創(chuàng)建Sessions回話
pod trunk me- 保留上述窗口,發(fā)布
/更新組件至遠(yuǎn)程倉庫(cocoapods.org)
pod trunk push ScanHelper.podspec --verbose --allow-warnings --skip-import-validation推送成功,上述郵件隨后會下發(fā)通知- 從遠(yuǎn)程倉庫(
cocoapods.org)刪除已發(fā)布組件
pod trunk delete ScanHelper 0.0.1[!] CocoaPods could not find compatible versions for pod "ScanHelper"- 新版本發(fā)布后,且收到郵件提醒,但
install沒有下載成功,
嘗試鍵入如下指令修復(fù)問題
pod cache clean ScanHelper pod install --repo-update - 本地校驗
.podspec文件,常用鍵值對及相關(guān)規(guī)則
Pod::Spec.new do |spec|
spec.name = "ScanHelper"
spec.version = "0.0.6"
spec.license = "MIT"
spec.summary = "A lightweight scanning component based on system API in Swift5"
spec.description = <<-DESC
No memory leaks, Support scaling, Support light sense to automatically turn on the flash, Support auto zoom, Support custom UI.
DESC
spec.author = { "Charlie" => "a51095@hotmail.com" }
spec.homepage = "https://github.com/a51095/ScanHelper"
spec.source = { :git => "https://github.com/a51095/ScanHelper.git", :tag => spec.version }
spec.requires_arc = true
spec.swift_version = "5.0"
spec.platform = :ios, "11.0"
spec.ios.deployment_target = "11.0"
spec.static_framework = true
spec.ios.vendored_frameworks = 'lib/ScanHelperSDK.framework'
spec.source_files = "lib/ScanHelperSDK.framework/**/*"
spec.public_header_files = 'lib/ScanHelperSDK.framework/Headers/ScanHelperSDK-Swift.h'
# ======================================================
# spec.ios.exclude_files = 'lib/xxxx.dec' (忽略的文件)
# spec.source_files = 'lib/ScanHelperSDK.framework/**/*'(資源文件)
# spec.public_header_files = 'lib/ScanHelperSDK.framework/Headers/ScanHelperSDK-Swift.h'(Objective-C暴露頭文件)
# ======================================================
#??????????????
# * 匹配所有類型文件
# *.{h,m} 匹配所有以 .h 和 .m 結(jié)尾的文件
# ** 匹配所有子目錄
#??????????????
end
常用指令
- 驗證某個 framework, 屬于動態(tài)庫還是靜態(tài)庫
- 提示
current ar archive random library靜態(tài)庫 - 提示
dynamically linked shared library動態(tài)庫
- 提示
cd xxxx.framework
file xxxx
- 查看某個 framework, 所支持框架
- 提示
armv7 arm64 armv7s arm64e - 提示
i386 x86_64
- 提示
lipo -info 路徑/xxxx.framework/xxxx
- 打包 xcframework
xcodebuild -create-xcframework -framework a.framework -framework b.framework -output xxxx.xcframework




