I have tried:
- (NSString*) generateString
{
NSString* stringToReturn = @"thisString";
return stringToReturn;
}
- (void) otherMethod
{
NSString *returnedString = [self generateString];
if (returnedString == @"thisString")
{ // Do this }
else if (returnedString == @"thatString")
{ // Do that }
}
Which never matches.
I have then tried
if ([returnedString compare:@"thisString"] == 1)
But the compare method always returns 1 for me, even when comparing with a different string.
What is the correct way to do this, and what result should I expect?