我正在構造所有數據看起來像來自服務器的響應數據字典。 現在,newsFeedsDict1哪個應該字典爲博利和全球不僅顯示全球字典內的所有數據只。而我的for循環正在運行顯示正確的數據博利。但第二次顯示博利的數據也在全球字典。NSMutableDictionary給予所有相同的值,而不是新的新值
如果(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];
}
}