我是新來的JSON,並通過我的JSON數組這樣IOS JSON - 獲得意想不到的結果在控制檯
for (NSDictionary *dict in self.contentArray) {
NSLog(@"%@", dict);
}
試圖循環,但繼續得到這種類型的內容,而不是實際的字典在控制檯:
<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