如何将cocoapods添加到现有工作区而不是项目

时间:2022-06-29 10:57:41

I am working on a project which is composed of three other projects in a workspace. I want to use CocoaPods to manage my dependecies in the workspace, but CocoaPods always creates its own workspace with only one addtional project. What I want to do is to add CocoaPods project to the workspace that already exists. Is there any simple way to achive that?

我正在开发一个项目,该项目由工作区中的其他三个项目组成。我想使用CocoaPods来管理我在工作区中的依赖,但CocoaPods总是创建自己的工作区,只有一个addtional项目。我想要做的是将CocoaPods项目添加到已经存在的工作区。是否有任何简单的方法来实现这一目标?

2 个解决方案

#1


8  

You can specify a workspace in your podfile.

您可以在podfile中指定工作区。

workspace 'MyWorkspace'

Please consult this link for more info: http://guides.cocoapods.org/syntax/podfile.html#workspace

有关详细信息,请参阅此链接:http://guides.cocoapods.org/syntax/podfile.html#workspace

#2


15  

In terminal go to directory with your xcworkspace-file.

在终端中使用xcworkspace文件转到目录。

$ touch Podfile

$ touch Podfile

then in Podfile :

然后在Podfile中:

workspace 'YourWorkspace'

target 'YourProjectName' do
    platform :ios, '8.0'
    pod 'your pod' 
    project 'Path to your Project in your workspace'
end

$ pod install

$ pod安装

#1


8  

You can specify a workspace in your podfile.

您可以在podfile中指定工作区。

workspace 'MyWorkspace'

Please consult this link for more info: http://guides.cocoapods.org/syntax/podfile.html#workspace

有关详细信息,请参阅此链接:http://guides.cocoapods.org/syntax/podfile.html#workspace

#2


15  

In terminal go to directory with your xcworkspace-file.

在终端中使用xcworkspace文件转到目录。

$ touch Podfile

$ touch Podfile

then in Podfile :

然后在Podfile中:

workspace 'YourWorkspace'

target 'YourProjectName' do
    platform :ios, '8.0'
    pod 'your pod' 
    project 'Path to your Project in your workspace'
end

$ pod install

$ pod安装