什么导致Mac OS X上找不到合适的图像错误?

时间:2009-03-05 23:03:41

标签: objective-c cocoa unit-testing xcode debugging

我跟随Chris Hanson的advice关于在Xcode 3.1中调试框架单元测试,但是当试图运行自定义可执行文件时,程序崩溃,说明以下错误消息[替换$(BUILD_PRODUCTS_DIR)的实际位置构建产品]。

2009-03-02 19:56:03.414 otest[28059:10b] Error loading
    $(BUILD_PRODUCTS_DIR)/Debug/Unit Tests.octest/
    Contents/MacOS/Unit Tests: dlopen($(BUILD_PRODUCTS_DIR_)/Unit
    Tests.octest/Contents/MacOS/Unit Tests, 265):
    no suitable image found. Did find:
    $(BUILD_PRODUCTS_DIR)/Unit Tests.octest/Contents/MacOS/Unit Tests:
    mach-o, but wrong architecture
2009-03-02 19:56:03.561 otest[28059:10b] The test bundle at
    $(BUILD_PRODUCTS_DIR)/Unit Tests.octest could not be loaded because
    it is built for a different architecture than the currently-running
    test rig (which is running as unknown).
2009-03-02 19:56:03.568 otest[28060:203] *** NSTask: Task create for path
    '$(BUILD_PRODUCTS_DIR)/Unit Tests.octest/Contents/MacOS/Unit Tests'
    failed: 8, "Exec format error". Terminating temporary process.

我的问题是,是什么导致找不到合适的图片。找到:... 错误消息,如何让 ote em 可执行文件正确运行,以便我可以调试我的框架单元测试?

使用otest是否有更简单的方法可以做到这一点?

2 个答案:

答案 0 :(得分:6)

otest运行得很好。该错误告诉您它无法加载测试包,并且它无法加载测试包的原因是因为它不知道它正在运行的架构。

解决方案是在otest的环境中设置ARCHPREFERENCE。您可以在Xcode的自定义可执行编辑器中执行此操作。将其设置为要在其下运行测试的体系结构。

答案 1 :(得分:0)

Unit Tests.octest could not be loaded because it is built for a different architecture than the currently-running test rig表明依赖项是针对不同的系统构建的 - 可能是PPC / Intel不匹配等?