如何使用 cocoapods 向现有项目添加新框架?

How to add new framework to existing project using cocoapods?

我有我现有的项目 QuickGame,我想在其中添加使用 cocoapods 的框架(SwiftyJSONAlamofire)。我安装了 cocoapods 并在我的应用程序文件夹中创建了一个 pod 文件,但是现在,我不知道这个 pod 文件应该是什么样子,以便在我现有的项目中安装这个框架。

您的 pod 文件应如下所示:

platform :ios, '9.0'
use_frameworks!

target 'YOUR_TARGET_NAME' do
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'Alamofire',  :git => 'https://github.com/Alamofire/Alamofire.git'
end

然后转到终端 -> cd [托管 pod 文件的源文件夹] -> 然后执行:pod install

如果这对你有帮助,请告诉我