
NSMutableArray change object at Index

// Browse all messages (you can use "for (NSDictionary *message in allMessageArray)" enumerate loop but because we need the index to replace object, it's the best way to do that)
for (int index = 0; index < allMessageArray.count; ++index) {
// Get current message dictionary
NSDictionary *message = [allMessageArray objectAtIndex:index];
// If message came from good sender (you can use isEqualToString: if both objects are NSString instance)
if ([[message objectForKey:@"expediteur"] isEqual:[dicoChat2 objectForKey:@"expediteur"]]) {
// Create an autoreleased mutable copy of message array to modify some data
NSMutableDictionary *messageModified = [NSMutableDictionary dictionaryWithDictionary:message];
// *** Modify what you want in messageModified dictionary ***
// Replace original message with modified message in array (assume that allMessageArray is a mutable array) (It's very bad to modify an array in its enumerate loop but because we don't remove/add an object to the array, it's fine to do like that)
[allMessageArray replaceObjectAtIndex:index withObject:messageModified];
// *** If you know that you will have always only one message in array with good sender, you can break the loop here ***
}
}
// Write array to file
[allMessageArray writeToFile:datAllString atomically:YES];