首先呢泊脐,報(bào)錯(cuò)如下:
Error output from CocoaPods:
?
[!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle, 9): no suitable image found. Did find: (LoadError)
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle: mach-o, but wrong architecture
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle
……
Error running pod install
項(xiàng)目根目錄中執(zhí)行以下命令:
sudo gem install ffi
然后進(jìn)入到Podfile文件所在目錄(也就是項(xiàng)目下的ios目錄)空幻,執(zhí)行以下命令:
arch -x86_64 pod install or pod install
或者是
pod install
如果還是報(bào)錯(cuò),并且是m1芯片容客,可以參考如下命令
1秕铛、先卸載Ruby
brew uninstall ruby --force
2、卸載可能已經(jīng)安裝但沒(méi)成功安裝的CocoaPods
sudo gem uninstall cocoapods
sudo gem uninstall cocoapods-core
sudo gem uninstall cocoapods-downloader
3缩挑、重新安裝ffi和cocoapods
sudo arch -x86_64 gem install ffi
sudo arch -x86_64 gem install cocoapods
4但两、最后仍然在Podfile文件所在的目錄(項(xiàng)目的ios目錄),運(yùn)行
arch -x86_64 pod install
此時(shí)已經(jīng)安裝成功供置,再次啟動(dòng)項(xiàng)目谨湘,“Running pod install...”這一步已經(jīng)可以順利通過(guò)了。
整理不易,如果有幫助謝謝點(diǎn)贊支持紧阔。