Question

I'm creating mac application to create a pList file with coordinates for views to be use in iPhone/iPad but I'm getting this error "no known class method for selector valueWithCGRect".

Here is my code:

NSMutableArray *locations = [NSMutableArray new];
[locations addObject:[NSValue valueWithCGRect:CGRectMake(50,50,280,323)]];

Any of you knows how can I fix this or if is a work around this to fix my mac app.

I'll really appreciate you help.

Was it helpful?

Solution

On Mac OS there's +[NSValue valueWithRect:]. It takes an NSRect but on 64 bit that's just a typedef'd CGRect.

Bear in mind that you can't put arbitrary NSValues into a plist.

OTHER TIPS

Can you check if you have imported UIKit ? Just add:

#import <UIKit/UIKit.h>

and the your code should work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top