我是新来的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