开发者

CGRect and utesting

开发者 https://www.devze.com 2023-02-01 07:24 出处:网络
I am trying to add unit tests to my iPhone project in Xcode.Everything works, its great.Except when I am adding a class.m that uses CGRect (or other structs, CGPoint etc) to the unit test target (unde

I am trying to add unit tests to my iPhone project in Xcode. Everything works, its great. Except when I am adding a class.m that uses CGRect (or other structs, CGPoint etc) to the unit test target (under "Compile Sources") - I am getting a compilation error: "'CGRect' undeclared (first use in this function)". I tried messing with my unit test target in various ways, but so far I haven't bee开发者_如何学JAVAn able to get past this. What am I missing?


If it's undeclared, you haven't included the CoreGraphics header file:

#import <CoreGraphics/CoreGraphics.h>


You need to add the CoreGraphics framework to your unit testing target. In your project, under Frameworks, right-click on CoreGraphics.framework and select "Get Info". Click the "Targets" button at the top of the info window, and check the box next to your unit testing target.

0

精彩评论

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