[英]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.