天天看点

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字段的类库出现。

未完 待续。。。