我试图单元测试实例化字体一些iPhone的代码。我已经收窄,以下崩溃的单元测试:为什么实例在iphone单元测试UIFont导致崩溃?
#import "test.h"
#import <UIKit/UIKit.h>
@implementation test
- (void)testFonts {
[UIFont systemFontOfSize:12];
}
@end
这崩溃与错误:
Test Case '-[test testFonts]' started.
/Developer/Tools/RunPlatformUnitTests.include: line 415: 79768 Trace/BPT trap "${THIN_TEST_RIG}" "${OTHER_TEST_FLAGS}" "${TEST_BUNDLE_PATH}"
/Developer/Tools/RunPlatformUnitTests.include:451: error: Test rig '/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/Developer/usr/bin/otest' exited abnormally with code 133 (it may have crashed).
好像有一些设置,我没有在我的单元测试的目标在做做这个工作。你如何测试实例化字体的东西?
您应该提供控制台输出以更好地进行调试。但是,访问字体不需要额外的步骤,您的操作方式就好了。问题是:不包括/链接到正确版本的UIKit或代码中的其他地方。 – Till 2009-11-14 13:47:24
也得到这个崩溃。任何尝试调用systemFontOfSize:完全破坏它。 /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/Developer/usr/bin/otest'以代码133异常退出(它可能已崩溃)。 – featherless 2010-05-31 06:23:56
嘿,有什么我可以做的,使答案更完整/有帮助吗?如果没有...我可以有接受汉堡? – beOn 2012-03-22 20:44:17