【问题标题】:Failed to import Quick/Nimble in test target with cocoapods使用 cocoapods 在测试目标中导入 Quick/Nimble 失败
【发布时间】:2018-10-08 10:33:43
【问题描述】:

问题:突然,我使用 Xcode 10 创建的项目中的测试目标开始失败,并显示消息“import Quick could not find module”。

其他详细信息:如果我不构建主目标,则测试目标将在找不到“FirebaseCore/FirebaseCore.h”文件时失败。我还可以看到,仅构建测试目标 [之前清理项目] 不会触发任何依赖项的构建,无论是来自主目标还是测试目标依赖项。

Podfile 看起来像这样

ENV['COCOAPODS_DISABLE_STATS'] = "true"
platform :ios, '10.0'

use_frameworks!

target 'MyProject' do
  pod 'Firebase/Core'
  pod 'Crashlytics'
  pod 'Alamofire'
  pod 'KeychainSwift'

  target 'MyProjectTests' do 
    inherit! :search_paths

    pod 'Quick'
    pod 'Nimble'
  end

  target 'MyProjectUITests' do
    inherit! :complete   
  end
end

post_install do |installer_representation|
    installer_representation.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          if config.name == 'Debug'
            config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'YES'
          end
            config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
        end
    end
end

我该如何解决这个问题并确保构建测试目标会触发构建所有依赖项,无论是来自主目标还是它自己的依赖项?

【问题讨论】:

    标签: cocoapods xcode10 quick-nimble


    【解决方案1】:

    解决方案

    确保勾选“YourTestSchema” -> 编辑架构 -> 构建 -> 查找隐式依赖项

    其他详情: 由于 Quick 根据 Xcode 10 新构建系统具有循环依赖关系,因此我关闭了此设置并且再也没有考虑过它,直到我的 CI 失败。确保你没有犯同样的错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多