Is there a way to get compare class name betweeen 2 objects?
Like:
NSString *bla = [[NSString alloc] init];
if([bla class] isEqual: NSString])
NSLog(@"success");
unsure if my syntax is correct.
Is there a way to get compare class name betweeen 2 objects?
Like:
NSString *bla = [[NSString alloc] init];
if([bla class] isEqual: NSString])
NSLog(@"success");
unsure if my syntax is correct.
This should do it:
NSString *bla = [[NSString alloc] init];
if ( [bla isMemberOfClass: [NSString class]] == YES )
NSLog(@"Success");
Correct syntax is:
if ([bla class] == [NSString class])
You can also use -isMemberOfClass:
or -isKindOfClass:
messages from NSObject
protocol.