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] 辞書: (バナナ、アップル、サムチーズ)
私が理解していることから、辞書の中にあるものは何でもキー値を持っていません。どうすればいいの?どうすれば修正できますか?辞書の操作を容易にするためのキーが必要です。
よろしく、