David David - 1 year ago 100
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

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download