简体   繁体   English

在单个工作区中管理多个项目的依赖关系

[英]Manage dependencies of multiple projects in a single workspace

I have a workspace set like this: 我有一个像这样的工作区:

MyAppiOS project
MyAppMacOS project
Pods
   AFNetworking

Pods project was added to the initial workspace (MyAppiOS project) with the podfile 使用podfile将Pods项目添加到初始工作空间(MyAppiOS项目)

platform :ios, '5.0'

pod 'AFNetworking', '1.1'

and the pod install command pod install命令

Now I woud like MyAppMacOS to also link with AFNetworking. 现在,我想像MyAppMacOS一样也与AFNetworking建立联系。
I have seen example of podfiles with multiple targets, but with a common platform. 我已经看到了具有多个目标的podfiles的示例,但是具有通用平台。 I could not find an example of podfile that would work with multiple platforms. 我找不到可以使用多个平台的podfile示例。
I also tried using two podfiles for the two projects, but a pod install command creates two workspaces. 我还尝试为两个项目使用两个podfiles,但pod install命令创建了两个工作区。

What is the best way to use CocoaPods in that scenario? 在这种情况下使用CocoaPods的最佳方法是什么?

How about 怎么样

MyAppiOS project with folder
    Pods
       AFNetworking
MyAppMacOS project with folder
    Pods
       AFNetworking
MyAppCommon folder

You can still add files from MyAppCommon in the platform specific projects. 您仍然可以在特定于平台的项目中添加MyAppCommon中的文件。

Try something like this, where you specify the workspace that should be created, and the platform for each target/project combination. 尝试这样的事情,您可以在其中指定应创建的工作空间,以及每个目标/项目组合的平台。 You can adjust the project files to point to different folders where each platform's source is located. 您可以调整项目文件以指向每个平台源所在的不同文件夹。


workspace 'MyWorkspace.xcworkspace'
platform :ios

def import_pods
  pod 'AFNetworking'
end

target :'MyAppiOS' do
    platform :ios
  xcodeproj 'MyAppiOS.xcodeproj'
  import_pods
end

target :'MyAppOSX' do
    platform :osx
  xcodeproj 'MyAppOSX.xcodeproj'
  import_pods
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在iOS的单个工作区中的多个项目之间添加依赖项 - How to add dependency between multiple projects in single workspace in iOS 如何在iOS中的单个项目副本中管理多个项目? - How to manage multiple projects in single project copy in iOS? 具有多个项目的工作区或具有多个目标的一个项目? - Workspace with multiple projects or one project with multiple targets? 使用Cocoapods管理多个目标的依赖关系 - Manage Dependencies of Multiple Targets with Cocoapods 目标c在一个工作区中添加多个项目 - objective c Adding multiple projects in one workspace 将Crittercisim SDK集成到具有多个项目的工作区中 - Integrating Crittercisim SDK in workspace with multiple projects 在Bitbucket存储库上推送具有多个项目的Workspace - Push Workspace with multiple projects on Bitbucket repository 具有多个项目和Coca Pod设置的Xcode工作区 - Xcode Workspace with Multiple Projects and Coca Pods Setup iOS Cocoa Frameworks工作空间中的多个依赖项 - iOS Cocoa Frameworks multiple dependencies in workspace 确定在Xcode 5工作区中构建项目的顺序(具有静态库项目之间的依赖关系) - Determine order of building projects in Xcode 5 workspace (with dependencies between static library projects)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM