コンソールで予期しない結果を取得し、このIOS JSON - 私はJSONに新たなんだ
for (NSDictionary *dict in self.contentArray) {
NSLog(@"%@", dict);
}
のように私のJSON配列をループしようとしているが、コンソールに代わり、実際の辞書のこのタイプのコンテンツを取得しておきます:ここでは
<Content: 0x7fd9b1037950>
は、私は配列を作成するために使用私のコードです:二つの
// Create a new array to hold the locations
NSMutableArray *locations = [[NSMutableArray alloc] init];
// Get an array of dictionaries with the key "locations"
NSArray *array = [jsonDictionary objectForKey:@"data"];
// Iterate through the array of dictionaries
for(NSDictionary *dict in array) {
// Create a new Location object for each one and initialise it with information in the dictionary
Content *content = [[Content alloc] initWithJSONDictionary:dict];
// Add the Location object to the array
[locations addObject: content];
}
これは実際にあなたの配列にあるためです。どのように配列を作成していますか? – dan
コードを実際に読めるように編集してください。 – dan
期待どおりの行動を取っていますが、それ以外に何が期待されていますか?あなたはコンテンツオブジェクトを格納していて、それを取得しています。 – ldindu