XCTest:无法加载包“目标测试",因为无法找到其可执行文件 [英] XCTest: The bundle “target Tests” couldn’t be loaded because its executable couldn’t be located
问题描述
我使用的是 XCode 6.2,我有一个包含多个目标且没有测试的项目.
I'm using XCode 6.2 and I have a project with several targets and with no tests.
我现在正在尝试为其中一个目标包含 XCTest.为此,我添加了一个新的Cocoa Touch Testing Bundle"并选择了我想要作为宿主的目标.
I'm trying to include now XCTest for one of the targets. To do so, I add a new "Cocoa Touch Testing Bundle" and select the target that I want as a host.
当尝试使用 Cmd+U 启动测试时,模拟器启动,打开应用程序几毫秒,然后关闭,启动此消息:
When trying to launch the test with Cmd+U, the simulator launches, opens the app for some milliseconds and then it closes, launching this message:
IDEBundleInjection.c:加载包时出现错误 4'/Users/pepito/Library/Developer/Xcode/DerivedData/Flight-gpauftblwwxtvevnylzllkypkjy/Build/Products/Debug-iphonesimulator/targetTests.xctest':无法加载包目标测试",因为无法找到其可执行文件.
IDEBundleInjection.c: Error 4 loading bundle '/Users/pepito/Library/Developer/Xcode/DerivedData/Flight-gpauuftblwwxtvevnylzllkypkjy/Build/Products/Debug-iphonesimulator/target Tests.xctest': The bundle "target Tests" couldn’t be loaded because its executable couldn’t be located.
当我检查那里指定的文件夹时,只有 Info.plist 文件,但没有可执行文件.
When I check the folder specified there, there is a just the Info.plist file, but there is no executable.
我尝试添加一个分支新应用程序目标,它为它添加了自动测试.尝试运行测试时会发生同样的错误.
I have tried adding a branch new app target, which added automatically tests for it. The same error happens there when trying to run the tests.
如果我在一个全新的 XCode 项目中为目标创建测试,那么它工作正常.
If I create tests for a target in a brand new XCode project, then it works fine.
推荐答案
我终于设法解决了这个问题.它与默认为 XCTest 目标选择的编译器有关.它选择了不支持的编译器",我改为默认编译器(Apple LLVM 6.1)",然后它又开始工作了.
I finally managed to solve the problem. It was related to the compiler selected by default for the XCTest target. It had selected "Unsupported Compiler" and I changed to "Default compiler (Apple LLVM 6.1)" and it started working again.
这篇关于XCTest:无法加载包“目标测试",因为无法找到其可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!