嗨,我有这个代码。
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;
}
无论如何我可以做一个 if 语句来表明如果值为 1 则执行此操作,如果不是则执行此操作。我在下面尝试过。
if ([responseDict objectForKey:@"status = 1"]) {
Then do this
}
但它没有用,我做错了什么或者我能做些什么?