天天看點

CocoaPods 安裝第三方時出現的問題及解決

錯誤一

Pods written in Swift can only be integrated as frameworks; add `use_frameworks!` to your Podfile or target to opt into using it. The swift Pod being used is: FBSnapshotTestCase
           

可能是要添加的這個庫 不支援swift導緻

解決方法

在podfile裡面添加 use_frameworks!

# platform :ios, '10.0'
target 'iOSShellNew' do
pod 'Cordova'
pod 'jsoncpp'
pod 'Cache'
use_frameworks!
end
           

錯誤2

pod search AFNetworking 出現錯誤

[!] Unable to find a pod with name, author, summary, or description matching

AFNetworking“

解決方法

删除~/Library/Caches/CocoaPods目錄下的search_index.json檔案

  • pod setup成功後會生成~/Library/Caches/CocoaPods/search_index.json檔案。
  • 終端輸入rm ~/Library/Caches/CocoaPods/search_index.json
  • 删除成功後再執行pod search
  • 輸出:Creating search index for spec repo ‘master’.. Done!,稍等片刻就會出現所有帶AFNetworking字段的類庫出現。

未完 待續。。。