通过Cocoapods使用第三方库

Cocoapods

Install Cocoapods

  1. Run in terminal:
sudo gem install cocoapods
  1. After installation, there will be a lot of messages, read them and if no error found, it means cocoapods installation is done. Next, you need to setup the cocoapods master repo. Type in terminal:
pod setup

It will download the master repo. The size is very big. It can take a while.

  1. Once it output "Setup Complete", you can create your Xcode project.

  2. In terminal, cs to "your Xcode project root directory" (where your .xcodeproj file resides) and run:

pod init
  1. Create a Podfile and open it in Xcode:
open -a Xcode Podfile
  1. Your Podfile will get open in test mode. Initially there will be some default commands. Here is where you add your project's dependencier. For example, in Podfile, type:
use_frameworks!
target 'Your App Name' do
  pod 'Socket.IO-Client-Swift', '~> 8.1.0' # Or latest version
end
  1. Run in terminal:
pod install

Now you can use this third party lilbrary - SocketIO. Close xcodeproj and open xcworkspace. Start coding

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容