views:

20

answers:

1

Hello,

I using the project named coredatabooks from apple developer examples.

#import 

@interface Book : NSManagedObject  
{
}

@property (nonatomic, retain) NSNumber *active;
@property (nonatomic, retain) NSString *title;
@property (nonatomic, retain) NSString *author;
@property (nonatomic, retain) NSDate *copyright;

@end

I need to use a bool object, but I don't know how to implement it in my class.. I'm using right now NSNumber, using an integer (0, 1) but is not a Bool... maybe it will be more correct to use this ...

@property (nonatomic, retain) bool active;

but is not working.

A: 

You can still use an NSNumber, but pack it from a bool:

[NSNumber numberWithBool: myBool];

and unpack it to a bool:

[myNSNumber boolValue];
Jon Rodriguez