У меня есть NSMutableArray (т.е. "истории") элементов словаря.
Я могу читать элементы словаря в массиве очень хорошо, например,
[[[stories objectAtIndex: b] objectForKey: @"title"]
Но сейчас я пытаюсь обновить (т.е. заменить) пару объектов, например. "title" & "matchword", но я не могу найти правильный код. Любые предложения приветствуются.
Я пытался это сделать, но, похоже, он добавляет в массив совершенно новые объекты
NSMutableDictionary *itemAtIndex = [[NSMutableDictionary alloc]init];
[itemAtIndex setObject:[[placesArray objectAtIndex:a]objectAtIndex:0] forKey:@"reference"];
[stories replaceObjectAtIndex:x withObject:itemAtIndex]; // replace "reference" with user's unique key
[itemAtIndex release];
Я тоже попробовал это (но тоже не сработало):
//NSMutableDictionary *itemAtIndex2 = [[NSMutableDictionary alloc]init];
//[itemAtIndex2 setObject:[separatePlaces objectAtIndex:x] forKey:@"matchingword"];
//[stories insertObject:itemAtIndex2 atIndex:x]; // add the unique matching word to story
//[itemAtIndex2 release];
Помощь оценена. Спасибо.