Skip to content

Instantly share code, notes, and snippets.

@ccgus ccgus/gist:8327134
Created Jan 9, 2014

Embed
What would you like to do?
NSString isEqual: problems
static Boolean MOObjectEqual(const id value1, const id value2) {
debug(@"(id)value1: '%@'", NSStringFromClass([(id)value1 class]));
debug(@"(id)value2: '%@'", NSStringFromClass([(id)value2 class]));
debug(@"[(id)value1 isKindOfClass:[NSString class]]: %d", [(id)value1 isKindOfClass:[NSString class]]);
debug(@"[(id)value2 isKindOfClass:[NSString class]]: %d", [(id)value2 isKindOfClass:[NSString class]]);
return (Boolean)[(id)value1 isEqual:(id)value2];
}
2014-01-08 16:04:08.181 Cocoa Script Editor[6261:303] (id)value1: '__NSCFConstantString'
2014-01-08 16:04:08.181 Cocoa Script Editor[6261:303] (id)value2: '__NSCFString'
2014-01-08 16:04:08.182 Cocoa Script Editor[6261:303] [(id)value1 isKindOfClass:[NSString class]]: 1
2014-01-08 16:04:08.182 Cocoa Script Editor[6261:303] [(id)value2 isKindOfClass:[NSString class]]: 0
2014-01-08 16:04:08.182 Cocoa Script Editor[6261:303] +[__NSCFString _fastCStringContents:]: unrecognized selector sent to class 0x7fff7611e3a0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.