Hey, je suis en train de ping mon serveur et vérifiez la version de l'application - tout va bien jusqu'à présent:Objective-C ne peut pas utiliser les données stringWithContentsOfURL dans l'instruction IF
NSURL *url = [NSURL URLWithString:@"http://thetalkingcloud.com/static/ping_desktop_app.php?v=1.1"];
NSError *theNetworkError;
NSString *content = [NSString stringWithContentsOfURL:url encoding:NSASCIIStringEncoding error:&theNetworkError];
//make sure something was returned
if (!content) {
//didn't connect
//my code that goes here is all fine and works
} else {
//there was some content returned by the server
//this NSLog prints out the expected data ('success' without the quotes)
NSLog(@"server returned data: >|%@|<", content);
//PROBLEM:
//neither of these two EVER become true, even when the server DOES return success or update
//connected, check what the server returned
if (content == @"success") {
NSLog(@"all went perfect");
} else if (content == @"update") {
NSLog(@"version error");
}
}
Les instructions IF aren ne travaille pas pour une raison quelconque, quelqu'un peut-il m'aider s'il vous plaît? Merci.
merci beaucoup cela l'a réparé :) –
Pas de problème, ma première réponse acceptée :) –