使用CocoaPods的多个应用程序的项目/工作区结构 [英] Project/workspace structure for multiple apps with CocoaPods
问题描述
我即将迁移我的应用以使用 CocoaPods 。我当前的目录结构如下图所示。我有一个包含3个项目的工作区( ipad
, ipod
, common
)。 ipad
和 ipod
项目中的构建目标依赖于 common
project。
I'm about to migrate my app to use CocoaPods. My current directory structure looks like the diagram below. I have one workspace that contains 3 projects (ipad
, ipod
, common
). There are build targets in the ipad
and ipod
projects with dependencies on the common
project.
MyGreatApp
|
+-- MyGreatApp.xcworkspace
|
+-- ipad
| |
| +-- ipad.xcodeproj
| +-- (source code)
|
+-- ipod
| |
| +-- ipod.xcodeproj
| +-- (source code)
|
+-- common
|
+-- common.xcodeproj
+-- (source code)
我的问题是,我应该如何将其迁移到CocoaPods?看起来CocoaPods为您创建的每个 Podfile
创建一个新工作区。我想保留我的3项目工作区结构,因为它似乎可以很好地保持所有内容。我应该为每个带有目标的项目和一个 Specfile
为公共项目创建 Podfile
吗?我如何在XCode中设置呢?
My question is, how should I migrate this to CocoaPods? It looks like CocoaPods create a new workspace for each Podfile
that you create. I'd like to keep my 3-project workspace structure because it seems like it keeps everything together nicely. Should I create a Podfile
for each project with targets and a Specfile
for the common project? How do I set this up in XCode then?
推荐答案
在这篇文章的最新版本中,你需要有您的podfile格式如下:
In the latest version at the time of this post, you need to have your podfile in the following format:
workspace 'Test'
xcodeproj 'iphone/iphone.xcodeproj'
xcodeproj 'iphone2/iphone2.xcodeproj'
target :iphone do
platform :ios, '6.0'
pod 'RestKit'
xcodeproj 'iphone/iphone.xcodeproj'
end
target :iphone2 do
platform :ios, '6.0'
pod 'RestKit'
xcodeproj 'iphone2/iphone2.xcodeproj'
end
我确认这适用于现有工作区中的多个项目。
I verified that this is working for multiple projects in an existing workspace.
有关详细信息,请参阅此帖子: https://github.com/ CocoaPods / CocoaPods / issues / 738
See this post for more details: https://github.com/CocoaPods/CocoaPods/issues/738
这篇关于使用CocoaPods的多个应用程序的项目/工作区结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!