David David - 1 month ago 4x
iOS Question

Comparing data from NSNumber CoreData iOS

I've got in CoreData a

@property (nonatomic, retain) NSNumber * hidden;

which is Boolean. I am trying using following code
[object valueForKey:@"hidden"]

How can I compare the returned value, to use it in

if ([[object valueForKey:@"hidden"] isEqualToString:@"1"])

doesn't work


You can query the bool value of an NSNumber using [[object valueForKey:@"hidden"] boolValue] and that way you can do proper bool handling.