【问题标题】:Using Cocoapods in a Workspace with two apps在具有两个应用程序的工作区中使用 Cocoapods
【发布时间】:2017-02-22 04:49:33
【问题描述】:

我想在一个工作区中拥有两个应用程序(xcode 项目)。由于 Cocoapods 通常会生成工作区,因此我查看了是否可以执行此操作并找到了一些答案。推荐的 Podfile 如下所示:

workspace 'TestWorkspace'

   target 'TestApp1' do
   xcodeproj 'testApp1/testApp1.xcodeproj'
   workspace 'TestWorkspace'
       pod 'AFNetworking'
   end

   workspace 'TestWorkspace'

   target 'TestApp2' do
   xcodeproj 'TestApp2/TestApp2.xcodeproj'
       pod 'MBProgressHUD'
   end

(抱歉,不知道如何将 Ruby 代码格式化为 SO 格式)

所以我的文件夹结构看起来像一个 TestWorkspace 文件夹,有两个 App 项目文件夹和 Podfile。运行pod install

[!] xcodeproj 已重命名为 project。请相应地更新您的 Podfile。

和..

[!] CocoaPods 没有设置您项目的基本配置,因为您的项目已经有一个自定义配置集。为了使 CocoaPods 集成能够正常工作,请将目标 TestApp1 的基本配置设置为 ../Pods/Target Support Files/Pods-TestApp1/Pods-TestApp1.debug.xcconfig 或在构建配置中包含 ../Pods/Target Support Files/Pods-TestApp1/Pods-TestApp1.debug.xcconfig (TestApp1/Pods/Target Support Files/Pods-TestApp1/Pods-TestApp1.debug.xcconfig)。

所以我的问题是必须进行哪些更改才能使我的TestWorkspace 工作区具有三个项目:TestApp1TestApp2Pods

(顺便说一句,我将我的项目/工作区的真实名称更改为伪别名,以便在此处发布。希望我忠实地更改了所有内容。)


编辑:好的,所以我修复了第一个警告(只是从 xcodeproj 到 project 的 podfile 语法更改)。但是,我的工作区肯定没有正确配置。 pod installing 之后我什至没有看到 Pod 项目。

EDIT2: 好的,所以我通过将两个项目配置文件(调试和发布)都设置为“无”来修复第二个警告。所以现在我没有错误,但是 Pod 项目仍然找不到。 (对不起,如果我要解决部分问题,但我认为添加编辑比创建新问题更好)。

【问题讨论】:

    标签: xcode dependencies cocoapods podfile


    【解决方案1】:

    将目标用作 xcproject/workspaces 的范围。将podfile 更新为如下内容:

    workspace 'TestWorkspace'
    
       target 'TestApp1' do
       xcodeproj 'testApp1/testApp1.xcodeproj'
       workspace 'TestWorkspace'
           pod 'AFNetworking'
       end
    
       target 'TestApp2' do
       xcodeproj 'TestApp2/TestApp2.xcodeproj'
       workspace 'TestWorkspace'
           pod 'MBProgressHUD'
       end
    

    现在运行pod install --verbose

    【讨论】:

    • 所以基本上“范围”了工作空间内的两个目标?所以我将我的 podfile 更改为那个.. 我在详细日志中看到了所有好东西(不确定我是否要分享它——因为它没有编辑)但在“TestWorkspace”中仍然没有 Pod 项目。似乎这两个项目的配置似乎正确,因为它们具有带有非红色 xcconfigs 的 Pods 组。然而,两者的框架组都有一个红色的libPods-TestApp*.a
    猜你喜欢
    • 2012-09-28
    • 2014-03-20
    • 2022-06-27
    • 2019-09-15
    • 1970-01-01
    • 2019-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多