多个应用程序的项目/工作区结构。

时间:2023-01-17 22:15:14

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.

我打算把我的应用程序移植到可可豆上。我当前的目录结构如下图所示。我有一个工作空间包含三个项目(ipad, ipod, common)。ipad和ipod项目中的构建目标依赖于公共项目。

MyGreatApp
|
+-- MyGreatApp.xcworkspace
|
+-- ipad
|    |
|    +-- ipad.xcodeproj
|    +-- (source code)
|
+-- ipod
|    |
|    +-- ipod.xcodeproj
|    +-- (source code)
|
+-- common
     |
     +-- common.xcodeproj
     +-- (source code)

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?

我的问题是,我该如何把它移植到茧中呢?看起来可可豆为你创建的每个播客文件创建了一个新的工作区。我想保持我的3个项目的工作空间结构,因为它看起来把所有的东西都很好地放在一起。我是否应该为每个项目创建一个Podfile,其中包含目标和公共项目的Specfile ?那么如何在XCode中设置它呢?

1 个解决方案

#1


52  

In the latest version at the time of this post, you need to have your podfile in the following format:

在本文发布的最新版本中,您需要以以下格式拥有您的podfile:

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.

我验证了这适用于现有工作空间中的多个项目。

See this post for more details: https://github.com/CocoaPods/CocoaPods/issues/738

查看这篇文章,了解更多细节:https://github.com/cocoapods/es/738。

#1


52  

In the latest version at the time of this post, you need to have your podfile in the following format:

在本文发布的最新版本中,您需要以以下格式拥有您的podfile:

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.

我验证了这适用于现有工作空间中的多个项目。

See this post for more details: https://github.com/CocoaPods/CocoaPods/issues/738

查看这篇文章,了解更多细节:https://github.com/cocoapods/es/738。