swift項目打包一些問題

問題一 :CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compile

錯誤原因 :

因為iOS14 SDK不再支持armv7架構(gòu)的手機(jī),所以需要將armv7剔除。

解決方法:

選中項目PROJECT—Build Settings—Excluded Architectures,設(shè)置release模式下Any iOS SDK的值為**armv7,

問題二:導(dǎo)入第三方組件Kingfisher報錯

錯誤原因 :

是一些SwiftUI導(dǎo)致的。

解決方法:

在Podfile文件中添加以下函數(shù),然后運行pod install


platform :ios, "10.0"
use_modular_headers!
inhibit_all_warnings!
pre_install do |installer|
    remove_swiftui()
end

def remove_swiftui
  # 解決 xcode13 Release模式下SwiftUI報錯問題
  system("rm -rf ./Pods/Kingfisher/Sources/SwiftUI")
  code_file = "./Pods/Kingfisher/Sources/General/KFOptionsSetter.swift"
  code_text = File.read(code_file)
  code_text.gsub!(/#if canImport\(SwiftUI\) \&\& canImport\(Combine\)(.|\n)+#endif/,'')
  system("rm -rf " + code_file)
  aFile = File.new(code_file, 'w+')
  aFile.syswrite(code_text)
  aFile.close()
end

use_frameworks!

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容