我已经安装了 cocoapods。但是我不能使用 "pod search"

I haved installed cocoapods. But I cannot use "pod search"

我已经在 EI 上安装了 cocoapods。但是我不能使用 "pod search"

DolphindeMacBook-Pro:~ dolphin$ pod --version
1.0.0
DolphindeMacBook-Pro:~ dolphin$ pod search afnetworking
Creating search index for spec repo 'master'.. Done![!] Unable to find a pod with name, author, summary, or descriptionmatching `afnetworking`

如何解决

安装 cocoapods 后,执行以下步骤:

  • 打开一个终端window,然后$ cd 进入你的项目目录(cd ~/Path/To/Folder/Containing/your/app)
  • 通过 运行 $ pod init
  • 创建 Podfile
  • 打开podfile(open -a Xcode Podfile)添加podline并保存文件,例如:

pod 'AFNetworking', '~> 3.0'

  • 运行 $ pod install 在你的项目目录下
  • 打开App.xcworkspace

请查找更详细的指南here

希望对您有所帮助!

应该是正在创建搜索索引,我也是这样,大家耐心等待,如下:

$ pod search AFNetworking

Creating search index for spec repo 'master'.. Done! Creating search index for spec repo 'master-1'.. Done!

-> AFNetworking (3.1.0)
一个令人愉快的 iOS 和 OS X 网络框架。
pod 'AFNetworking', '~> 3.1.0'
- 主页:https://github.com/AFNetworking/AFNetworking
- 来源:https://github.com/AFNetworking/AFNetworking.git
- 版本:3.1.0、3.0.4、3.0.3、3.0.2、3.0.1、3.0.0、3.0.0-beta.3,
3.0.0-beta.2, 3.0.0-beta.1, 2.6.3, 2.6.2, 2.6.1, 2.6.0, 2.5.4, 2.5.3, 2.5.2,
2.5.1, 2.5.0, 2.4.1, 2.4.0, 2.3.1, 2.3.0, 2.2.4, 2.2.3, 2.2.2, 2.2.1, 2.2.0,
2.1.0, 2.0.3, 2.0.2, 2.0.1, 2.0.0, 2.0.0-RC3, 2.0.0-RC2, 2.0.0-RC1, 1.3.4,
1.3.3, 1.3.2, 1.3.1, 1.3.0, 1.2.1, 1.2.0, 1.1.0, 1.0.1, 1.0, 1.0RC3, 1.0RC2,
1.0RC1、0.10.1、0.10.0、0.9.2、0.9.1、0.9.0、0.7.0、0.5.1 [主回购]
- 子规格:
- AFNetworking/Serialization (3.1.0)
- AFNetworking/Security (3.1.0)
- AFNetworking/Reachability (3.1.0)
- AFNetworking/NSURLSession (3.1.0)
- AFNetworking/UIKit (3.1.0)

$ pod --version 1.0.1

  • 打开终端并运行rm ~/Library/Caches/CocoaPods/search_index.json
  • pod 搜索 AFNetworking

使用sudo rm ~/Library/Caches/CocoaPods/search_index.json以防上述命令请求许可