Skip to content

Instantly share code, notes, and snippets.

@hartbit
Created September 2, 2014 07:41
Show Gist options
  • Save hartbit/e8784e49dd062e6d0035 to your computer and use it in GitHub Desktop.
Save hartbit/e8784e49dd062e6d0035 to your computer and use it in GitHub Desktop.
@interface MyClass : NSObject
@property (nonatomic) BOOL boolProperty;
@end
@implementation MyClass
@end
// ...
MyClass* obj = [MyClass new];
// WORKS ON SIMULATOR, BUT CRASHES ON DEVICE
[obj setValue:@"1" forKey:@"boolProperty"];
NSAssert(obj.boolProperty, @"Invalid value");
[obj setValue:@"0" forKey:@"boolProperty"];
NSAssert(!obj.boolProperty, @"Invalid value");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment