运行测试时Xcode 11.6崩溃-库丢失

问题描述

我正在尝试运行一些XCTest。我已经不太熟悉了。我导入了我的主模块来测试一些类。我必须打开xcworkspace,而不是xcodeproj,然后编译。

但是,我仍然遇到问题。我正在macOS上使用CocoaPods将Sparkle和AppCenter添加到该应用程序。它在主应用程序中可以正常工作,但是当我运行测试时,它崩溃并显示以下消息:

dyld: warning: could not load inserted library '/Users//Library/Developer/Xcode/DerivedData/.../Frameworks/libXCTestBundleInject.dylib' into hardened process because no suitable image found.

dyld: Library not loaded: @rpath/Sparkle.framework/Versions/A/Sparkle

我试图导入这些框架,但它们也不起作用。我在构建设置中做错了什么还是缺少了什么?

我还尝试将它们添加到Podfile中,但该方法也不起作用。

那是我的测试班:

@testable import MyApplication
import XCTest

class MoneyTest: XCTestCase {

    var moneyEUR1 : Money!

    override func setUpWithError() throws {
        // Put setup code here. This method is called before the invocation of each test method in the class.

        self.moneyEUR1 = Money(number: 1200,currency: "EUR")
    }

    override func tearDownWithError() throws {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        
        self.moneyEUR1 = nil
    }

我的Podfile:

target 'MyApplication' do
  # Comment the next line if you don't want to use dynamic frameworks
  #use_frameworks!

  # Pods for MyApplication

  pod 'AppCenter'
  pod 'Sparkle'

  target 'MyApplication Tests' do
    inherit! :search_paths
    # Pods for testing
    # here I tried to add the pod aswell,which didn't work
    # it should actually inherit? shouldn't it?
  end
    
end

我不知道将Pods框架添加到测试目标的位置。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...