NSString - Comparing two strings in Objective-C
Wednesday, May 6, 2009 at 9:54AM Comparing strings in Obj-C is not done the same way as comparing two integers, bools, or even characters. For example, the following code will fail to get the desired results:
if (someString == @"someText") { // do stuff }
This will never run, because you are comparing pointers and not the content of the two strings. Instead, use this:
if ([someString isEqualToString:@"someText"]) { // do stuff }
iphonedev,
objective-c in
iPhonedev