iPhone单元测试链接问题,找不到DevToolsBundleInjection.framework [英] iPhone unit test linking problem, can't find DevToolsBundleInjection.framework

查看:64
本文介绍了iPhone单元测试链接问题,找不到DevToolsBundleInjection.framework的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的iPhone应用程序设置应用程序单元测试.因此,我制作了一份应用程序目标的副本,并制作了苹果文档(

Unable to read symbols for "/Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.1 (7C144)/Symbols/Developer/Library/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection" (file not found).

确实该文件不存在.我在下面找到了.framework文件: /Xcode3.1.4/Library/PrivateFrameworks PrivateFrameworks

并进行了符号链接.然后运行该应用程序,说它无法链接该应用程序的文件:

010-01-25 20:19:22.330 SmokeyTheBear[5808:207] Error loading /private/var/mobile/Applications/26E1F8F4-6444-415B-84CB-BB161DBA29E9/SmokeyTheBear.app/LogicTests.octest/LogicTests:  dlopen(/private/var/mobile/Applications/26E1F8F4-6444-415B-84CB-BB161DBA29E9/SmokeyTheBear.app/LogicTests.octest/LogicTests, 262): Symbol not found: _OBJC_CLASS_$_AppDelegate
  Referenced from: /private/var/mobile/Applications/26E1F8F4-6444-415B-84CB-BB161DBA29E9/SmokeyTheBear.app/LogicTests.octest/LogicTests
  Expected in: /var/mobile/Applications/26E1F8F4-6444-415B-84CB-BB161DBA29E9/SmokeyTheBear.app/UDorse
 in /private/var/mobile/Applications/26E1F8F4-6444-415B-84CB-BB161DBA29E9/SmokeyTheBear.app/LogicTests.octest/LogicTests
DevToolsBundleInjection: Error loading bundle '/private/var/mobile/Applications/26E1F8F4-6444-415B-84CB-BB161DBA29E9/SmokeyTheBear.app/LogicTests.octest'

然后,我切换回运行该应用程序的正常目标,它运行了我所有的单元测试并退出了!我再次清理并构建,然后正常目标正常运行.单元测试目标仍然无效.

解决方案

检查项目目标的构建设置.

查找默认情况下隐藏的符号"设置.

至少对于用于测试的调试版本,请确保将其设置为.

没有此设置(可能是从较早的Xcode项目中获得的设置),测试代码将不会自动链接到项目代码.

I'm trying to setup application unit tests for my iphone app. So I made a copy of the app target, and a unit test bundle target as described in apple's documentation (http://developer.apple.com/iphone/library/documentation/Xcode/Conceptual/iphone_development/135-Unit_Testing_Applications/unit_testing_applications.html)

After following Apple's directions, I wasn't able to reference my classes in the unit tests, so I linked the app into the unit test bundle using the "Bundle Loader" build setting and setting the main target to export symbols. That resolved the compilation time errors, and it worked and executed my tests immediately after I changed it. But once I cleaned and built again, I started getting this error when I tried to run on the device:

Unable to read symbols for "/Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.1 (7C144)/Symbols/Developer/Library/PrivateFrameworks/DevToolsBundleInjection.framework/DevToolsBundleInjection" (file not found).

It's true that the file doesn't exist. I found the .framework file under: /Xcode3.1.4/Library/PrivateFrameworks PrivateFrameworks

and made a symbolic link. Then running the app said that it couldn't link the app's files:

010-01-25 20:19:22.330 SmokeyTheBear[5808:207] Error loading /private/var/mobile/Applications/26E1F8F4-6444-415B-84CB-BB161DBA29E9/SmokeyTheBear.app/LogicTests.octest/LogicTests:  dlopen(/private/var/mobile/Applications/26E1F8F4-6444-415B-84CB-BB161DBA29E9/SmokeyTheBear.app/LogicTests.octest/LogicTests, 262): Symbol not found: _OBJC_CLASS_$_AppDelegate
  Referenced from: /private/var/mobile/Applications/26E1F8F4-6444-415B-84CB-BB161DBA29E9/SmokeyTheBear.app/LogicTests.octest/LogicTests
  Expected in: /var/mobile/Applications/26E1F8F4-6444-415B-84CB-BB161DBA29E9/SmokeyTheBear.app/UDorse
 in /private/var/mobile/Applications/26E1F8F4-6444-415B-84CB-BB161DBA29E9/SmokeyTheBear.app/LogicTests.octest/LogicTests
DevToolsBundleInjection: Error loading bundle '/private/var/mobile/Applications/26E1F8F4-6444-415B-84CB-BB161DBA29E9/SmokeyTheBear.app/LogicTests.octest'

Then, I switched back to running the normal target for the app, and it ran all my unit tests and exited! I cleaned again and built, and then the normal target ran normally. The unit test target still didn't work.

解决方案

Inspect your Build Settings for the project target.

Look for the "Symbols Hidden by Default" setting.

Make sure it is set to NO at least for the debug build, which you should be using for testing.

Without this setting (which may be brought through from older Xcode projects), the testing code will not auto-link to the project code.

这篇关于iPhone单元测试链接问题,找不到DevToolsBundleInjection.framework的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆