0
안녕하세요.이 코드가 있습니다.NSJSONSerialization 문제
NSString *infoString = [NSString stringWithFormat:@"http://link.com/post.php?name=%@&street=%@&city=%@&state=%@&zip=%@&lat=%@&lon=%@", name, street, city, state, zip, str1, str2];
NSURL *infoUrl = [NSURL URLWithString:infoString];
NSData *infoData = [NSData dataWithContentsOfURL:infoUrl];
NSError *error;
responseDict = [NSJSONSerialization JSONObjectWithData:infoData options:0 error:&error];
NSString *responseString = [responseDict copy];
NSLog(@"responseDict: %@", responseString);
콘솔에 표시됩니다.
2012-06-14 22:37:04.022 PartyApp[20221:fb03] responseDict: {
status = 1;
}
어쨌든 거기에 내가 할 수있는 문이 값이 1이면이 작업을 수행 할 것을 보여 경우 그 다음이 작업을 수행 있지 않은 경우입니다. 나는 아래에서 시도했다.
if ([responseDict objectForKey:@"status = 1"]) {
Then do this
}
하지만 작동하지 않았습니다. 무엇이 잘못 되었나요? 아니면 무엇을 할 수 있습니까? 위의 라인 :
앱이 0 또는 1을 반환했는지 어떻게 알 수 있습니까? –
@DewanPayroda는 내 업데이트를 살펴 봅니다. –
알았습니다! 고마워. –