开发者

Unit Testing in iphone i got below error

whenever i run the unit testing application to find whether appdelegate is there r not using the test suit

-(void)testAppDelegate
{
id app_delegate=[[UIApplication sharedApplication]delegate];
STAssertNotNil(app_delegate,@"delegate not found");
}

i got thi开发者_StackOverflow中文版s error. Please help.

"_OBJC_CLASS_$_UIApplication", referenced from:

  objc-class-ref-to-UIApplication in Tests.o

ld: symbol(s) not found

collect2: ld returned 1 exit status


I believe this is a linker error and not a runtime error. You need to link the same frameworks that you use in your iPhone build target to your unit test target. Particularly this error indicates that the UIKit framework is not linked to your unit test target. (To be safe link UIKit, Foundation and CoreGraphics as well to your target).

You can do this, by expanding the Targets node in XCode, get info on your unit test target, and under the General tab, in the Linked Libraries you need to add these 3 frameworks ;)

Hope this helps, Moszi

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜