cocoapods使用

1. pod search Alamofire

2.找到改第三方, copy pod 'Alamofire'名字, 敲入 echo "pod 'Alamofire'" > podfile 及生成podfile文件

3. cat podfile可以查看podfile内容

4. pod install

5. 提示

Installing Alamofire (1.2.3)

[!] Pods written in Swift can only be integrated as frameworks; this feature is still in beta. Add `use_frameworks!` to your Podfile or target to opt into using it.

6.敲入  vim podfile  键盘输入 i,进入编辑模式,在顶部粘贴 输入use_frameworks!

然后按Esc,并且输入“ :”号进入vim命令模式,然后在冒号后边输入wq

注意:键盘输入 :后,才能输入wq。回车后发现PodTest项目总目录中多一个Podfile文件

注:有时明明已经装好了, 但使用命令时依然提示not found, 可以执行下面这句

sudo gem install -n /usr/local/bin cocoapods 

原文地址:https://www.cnblogs.com/Milo-CTO/p/4663280.html