from: https://www.jianshu.com/p/87a5cca2a490
新版本的M1芯片運(yùn)行模擬器報(bào)CocoaPods庫(如:WechatOpenSDK報(bào)arm64錯(cuò)誤)錯(cuò)誤,是因?yàn)镸1兼容問題,解決辦法有兩種如下:強(qiáng)烈推薦方法2
方法1:強(qiáng)制打開xcode對x86的支持,有缺點(diǎn):因?yàn)檫€是采用x86,編譯速度很慢。
關(guān)閉xcode--應(yīng)用程序--xocde--右鍵簡介--通用--勾選使用Rosetta打開--重啟xcode即可

image.png
方法2(推薦):完全采用ARM架構(gòu),編譯速度顯著提升。
1、Build Settings--選擇basic--在User-Defined下點(diǎn)擊 ”+“
2、輸入 ”EXLUDED_ARCHS“--debug和release選擇Any iOs Simulator SDK,輸入arm64
3、Build Settings下找到EXcluded Architectures 設(shè)置debug和release選擇Any iOs Simulator SDK,輸入arm64
4、Podfile 加入下面的代碼
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
5、重新pod install
6、最后點(diǎn)擊xcode的Buildtime(如下面的截圖)自動(dòng)適配代碼即可。注:如果沒出現(xiàn)就再跑一遍pod install。
注意:遇到這種情況:ld: Framework not found),需要多clear下項(xiàng)目的緩存,關(guān)閉然后重啟xcode即可。

image.png
#source 'https://github.com/CocoaPods/Specs.git'
# 指明依賴庫的來源地址
source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
inhibit_all_warnings!
platform :ios, '9.0'
target "XXX" do
pod 'xxx'
end
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
作者:啾啾啾_YB
鏈接:https://www.jianshu.com/p/87a5cca2a490
來源:簡書
著作權(quán)歸作者所有。商業(yè)轉(zhuǎn)載請聯(lián)系作者獲得授權(quán),非商業(yè)轉(zhuǎn)載請注明出處。
點(diǎn)個(gè)廣告:
浙公網(wǎng)安備 33010602011771號(hào)