Xcode 添加Swift文件后无法运行测试

Xcode 添加Swift文件后无法运行测试,xcode,swift,xctest,Xcode,Swift,Xctest,我有一个已经有几年历史的项目,现在我想在Swift中创建一个新功能。但是,我无法在插入第一个swift文件后运行单元测试。编译测试,并启动模拟器。但在测试开始运行之前,我得到以下错误: Simulator session started with process 58478 Debugger attached to process 58478 IDEBundleInjection.c: Error 3587 loading bundle '/Users/jrv/Library/Caches/Ap

我有一个已经有几年历史的项目,现在我想在Swift中创建一个新功能。但是,我无法在插入第一个swift文件后运行单元测试。编译测试,并启动模拟器。但在测试开始运行之前,我得到以下错误:

Simulator session started with process 58478
Debugger attached to process 58478
IDEBundleInjection.c: Error 3587 loading bundle '/Users/jrv/Library/Caches/AppCode32/DerivedData/MobileBank-542f20a4/Build/Products/Debug-iphonesimulator/Test.xctest': The bundle “Test.xctest” couldn’t be loaded because it is damaged or missing necessary resources.
DevToolsBundleInjection environment:
XCInjectDiagnostics: (null)
XCInjectBundleInto: /Users/jrv/Library/Caches/AppCode32/DerivedData/MobileBank-542f20a4/Build/Products/Debug-iphonesimulator/Sydbank.app/Sydbank
XCInjectBundle: /Users/jrv/Library/Caches/AppCode32/DerivedData/MobileBank-542f20a4/Build/Products/Debug-iphonesimulator/Test.xctest
TestBundleLocation: (null)
TMPDIR: /Users/jrv/Library/Developer/CoreSimulator/Devices/8016383A-A404-4D35-BDCB-0ED5317AD44A/data/Containers/Data/Application/CA2E7792-CA10-4109-B95E-7B0CA9D18147/tmp
DYLD_LIBRARY_PATH: /Users/jrv/Library/Caches/AppCode32/DerivedData/MobileBank-542f20a4/Build/Products/Debug-iphonesimulator
DYLD_INSERT_LIBRARIES: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection
DYLD_FRAMEWORK_PATH: /Users/jrv/Library/Caches/AppCode32/DerivedData/MobileBank-542f20a4/Build/Products/Debug-iphonesimulator
DYLD_FALLBACK_LIBRARY_PATH: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib
DYLD_FALLBACK_FRAMEWORK_PATH: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks
即使是最简单的swift文件也会出现相同的错误:

import Foundation
class MyTests: XCTestCase {
}
搜索堆栈溢出给出了一些建议。我已经尝试,我已经,我已经,我已经,我已经,我已经确保我的桥接头被正确配置


如果您有任何建议,我们将不胜感激。

我尝试为我的Swift文件创建一个新的测试目标,这个目标成功了。然后,我逐个参数比较了我的旧测试目标和新测试目标之间的配置。我最终确定了一个参数,当我在测试目标上设置它时,它导致测试运行:

完整设置:

LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"

老实说,我不知道这意味着什么,但它是有效的

不幸的是,由于某种原因设置此配置不允许我的主程序链接:我有@executable\u path/./框架和@loader\u path/./框架。无论如何,它都会编译这些代码,但测试代表了注入问题。