有人能给我解释一下为什么tweet数是1吗?finalDict自动取款机只有一个字典,但arrayForLetter有6个字典,每个字典中都有一些值。如何从arrayForLetter获取全部6本词典?
NSEnumerator *enumerator = [finalDict keyEnumerator];
id key;
while ((key = [enumerator nextObject])) {
NSDictionary *arrayForLetter = [finalDict objectForKey:key];
NSLog(@"arrayForLetter %@",arrayForLetter);
NSEnumerator *myEnumerator = [arrayForLetter keyEnumerator];
id myKey;
while ((myKey = [myEnumerator nextObject])) {
statuses=[[arrayResults alloc] initWithAppDictionary:arrayForLetter andAppID:myKey];
tweets = [[NSMutableArray alloc] init] ;
[tweets addObject:statuses];
[countryList reloadData];
//NSLog(@"%@ : %@", key, [finalDict objectForKey:key]);
}
}发布于 2011-10-22 21:08:10
原因很明显..在while循环中,重新分配tweets数组,然后添加一个对象。要得到6的计数,您需要在while循环之前分配- init tweets数组!
https://stackoverflow.com/questions/7859714
复制相似问题