同时对 iOS 开发和 Objective-c 来说还很陌生。我有以下方法:
-(NSMutableArray *)fetchDatabaseJSON{
NSURL *url = [NSURL URLWithString:@"http://www.ios.com/ios/responseScript.php"];
NSError *error = nil;
NSURLRequest *request = [NSURLRequest requestWithURL:url];
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:NULL error:&error];
//jsonArray = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
//NSLog(@"Array: %@",[jsonArray objectAtIndex:0]);
jsonDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
NSLog(@"Dictionary: %@", jsonDictionary);
return jsonArray;
}
现在 NSLog 显示:
2013-02-03 19:15:37.081 TestConnection[24510:c07] 字典:(Bannana,Apple,SomeCheese)
据我了解,字典中的任何内容都没有键值。怎么会这样?我该如何解决?我希望能够拥有简化字典操作的键。
问候,