My program checks if an NSError
object exists, and sends it to another method, like this:
if([response isEqualToString:@""]) {
[self handleError:commandError];
}
In handleError:
, I try checking the localized description against an expected string like this:
-(void)handleError:(NSError*)error
{
NSString* errorDescription = [error localizedDescription];
NSLog(@"%@",errorDescription); //works fine
if([errorDescription isEqualToString:@"sudo: no tty present and no askpass program specified"]) {
NSLog(@"SO Warning: Attempted to execute sudo command");
}
}
However, the if statement isn't firing. The log outputs precisely the same thing I typed out in the if statement.