《IOS Xcode使用CocoaPods管理第三方库》

@环境配置遇到的error

《IOS pod stup失败,下载速度慢问题处理》

@操作步骤

1.确定环境是好的,若还有未安装的请先安装

pod search YTKNetwork

若是可以使用,会出现对应版本。结果如下

   pod search YTKNetwork
 
   YTKNetwork is a high level request util based on AFNetworking.
   pod 'YTKNetwork', '~> 2.0.4'
   - Homepage: https://github.com/yuantiku/YTKNetwork
   - Source:   https://github.com/yuantiku/YTKNetwork.git
   - Versions: 2.0.4, 2.0.3, 2.0.2, 2.0.1, 2.0.0, 1.3.0, 1.2.0, 1.1.0, 1.0.0,
   0.6.0, 0.5.0, 0.4.0, 0.3.0, 0.2.0, 0.1.0 [master repo]
 
-> YTKNetwork+MoerFinance (2.0.4.2)
   YTKNetwork is a high level request util based on AFNetworking.
   pod 'YTKNetwork+MoerFinance', '~> 2.0.4.2'
   - Homepage: https://github.com/MoerFinance/YTKNetwork
   - Source:   https://github.com/MoerFinance/YTKNetwork.git
   - Versions: 2.0.4.2, 2.0.4.1 [master repo]
 
-> YTKNetwork-uploadProgress (3.0.1)
   YTKNetwork is a high level request util based on AFNetworking.
   pod 'YTKNetwork-uploadProgress', '~> 3.0.1'
   - Homepage: https://github.com/welcommand/YTKNetwork-uploadProgress
   - Source:   https://github.com/welcommand/YTKNetwork-uploadProgress.git
   - Versions: 3.0.1 [master repo]
··· //省略更多
end

2.再起一个终端,创建一个Podfile文件(先cd应用根目录位置)

touch Podfile    //创建
open -e Podfile  //此时将打开一个空文件

3.再Podfile文件写入需要的第三方库(以YTKNetwork为例),记得保存后关闭

//未使用官方镜像,使用清华大学镜像
source ‘https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git’  

target 'MyNote1042' do
	pod 'YTKNetwork', '~> 2.0.4'
    //此处添加更多
end

4.在终端输入

pod install

下载文件需要过一会,显示如下说明成功

Analyzing dependencies
Downloading dependencies
Installing AFNetworking (3.2.1)
Installing YTKNetwork (2.0.4)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `name.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed.

[!] Smart quotes were detected and ignored in your Podfile. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.

[!] Automatically assigning platform `ios` with version `12.4` on target `MyNote1042` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

如提示,需要关闭xcode,你打开project须要双击 .xcworkspace 这个project,而不是之前的xcodeproj。

5.在此打开项目

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值