如何解决运行测试时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 举报,一经查实,本站将立刻删除。