问题描述
在终端进入项目根目录,运行 pod init 后,终端提示 pod: command not found。
问题原因
未安装 CocoaPods。
解决方法
参考如下步骤解决问题:
在终端运行 sudo gem install cocoapods,输入管理员密码,安装 CocoaPods。
成功安装后,重新进入项目根目录,运行 pod init,即可在项目文件夹下生成一个 Podfile 文本文件。
sudo gem install cocoapods 失败,请根据错误提示选择合适的解决方案:You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory,则建议运行 sudo gem install -n /usr/bin cocoapods 安装 CocoaPods。问题描述
安装 CocoaPods 失败,终端提示访问超时。错误信息示例如下:
fatal: unable to access 'https://github.com/Homebrew/homebrew-cask/': Failed to connect to github.com port 443: Operation timed out
问题原因
网络状况不好。
解决方法
参考如下步骤解决问题:
参考如下链接,使用 Ruby Gems 镜像源:
在终端运行 sudo gem install cocoapods,重新安装 CocoaPods。
问题描述
安装 RTC SDK 时遇到如下问题:
在 Podfile 文件中写入 pod 'library_name',在终端运行 pod install 后,安装的 SDK 不是最新版。
在 Podfile 文件中写入 pod 'library_name', 'latest_version',在终端运行 pod install 后,终端提示最新版不存在。错误信息示例如下:
[!] CocoaPods could not find compatible versions for pod "AgoraRtcEngine_iOS":
In Podfile:
AgoraRtcEngine_iOS (= 4.1.0)
None of your spec sources contain a spec satisfying the dependency: `AgoraRtcEngine_iOS (= 4.1.0)`.
问题原因
未更新本地的 CocoaPods 仓库。
解决方法
参考如下步骤解决问题:
pod repo update 更新本地的 CocoaPods 仓库。pod install,即可成功安装最新版 SDK。