I am a beginner in Ios developement and I'm trying to compare two string who are normaly equal but comparaison fail everytime and go to the else:
NSString *response = [session.channel execute:@"gpio read 0" error:&error];//execute SSH command and write this one in log
NSLog(response);
if ([response isEqualToString:(@"1")]) {
[session.channel execute:@"gpio write 0 0" error:&error];
} else {
[session.channel execute:@"gpio write 0 1" error:&error];
}
here are my output, response is equal to 1 but the if is not used:
2014-04-08 20:01:38.065 domotiqueRPI[36948:1303] NMSSH: Exec command gpio read 0
2014-04-08 20:01:38.108 domotiqueRPI[36948:60b] 1
2014-04-08 20:01:38.109 domotiqueRPI[36948:1303] NMSSH: Exec command gpio write 0 1
Of course i search on stackOverFlow but all it tell to me : is to use isEqualToString method