我正在构建所有数据,使其看起来像来自服务器的响应数据字典。现在,应该为Bolly和Global使用 Dictionary 的newsFeedsDict1不仅显示 Global 字典中的所有数据。当我的 for 循环运行时,它显示了Bolly的正确数据。但这是第二次在全球词典中显示Bolly 的数据。
if(internetStatus == NotReachable) {
NSMutableArray *titleArr = [[NSMutableArray alloc] init];
NSMutableArray *wholeFeeds = [[[NSMutableArray alloc] init] autorelease];
[titleArr addObject:@"Bolly"];
[titleArr addObject:@"Global"];
for (NSString *title in titleArr) {
//titleArr = [[NSUserDefaults standardUserDefaults] objectForKey:@"TitleArray"];
NSLog(@"TITle arr %@",titleArr);
NSLog(@"No internet");
OrderedDictionary *newsFeedsDict1 = [[[OrderedDictionary alloc] init] autorelease];
NSMutableDictionary *newsFeedsDict = [[[NSMutableDictionary alloc] init] autorelease];
NSMutableArray *myLocalArray= [[[NSMutableArray alloc] init] autorelease];
myLocalArray = [[Database sharedDatabase] getArticleData:title];
NSMutableDictionary *articleDict = [[[NSMutableDictionary alloc] init] autorelease];
[articleDict setObject:myLocalArray forKey:@"article"];
[newsFeedsDict setObject:articleDict forKey:@"Articles"];
[newsFeedsDict setObject:title forKey:@"@name"];
[newsFeedsDict1 setObject:newsFeedsDict forKey:title];
[wholeFeeds addObject:newsFeedsDict1];
NSLog(@"news feed dict %@",newsFeedsDict1);
NSMutableDictionary *temparticleDictionary = [[NSMutableDictionary alloc] init];
self.articleDictionary = temparticleDictionary;
self.categoriesDictionary = [[NSMutableDictionary alloc] init];
self.categoriesDictionary =newsFeedsDict1;
[self createArticleDictionaryForCategory:newsFeedsDict];
}
}