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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22295833/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 04:43:58  来源:igfitidea点击:

How to add cocoapods to existing workspace not project

iosxcodecocoapods

提问by pawel.kalisz

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 总是创建自己的工作区,只有一个附加项目。我想要做的是将 CocoaPods 项目添加到已经存在的工作区中。有什么简单的方法可以实现吗?

采纳答案by Thomas Keuleers

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

回答by Illya Krit

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 install