How can I delete a chat message that was saved with xep-0136 (Archiving messages)?
I want to provide the user with the functionality to delete one or more messages at a time using a long-tap / select action.
I know you want to know what I have tried so far. But the point is, I haven't found anything regarding deleting messages to implement.
Any help is greatly appreciated!
+3
source to share
1 answer
You need to delete the message from the xmpp core database. So xmpp has created an "XMPPMessageArchiving_Message_CoreDataObject" named core database table, and with that you can delete the message.
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"XMPPMessageArchiving_Message_CoreDataObject" inManagedObjectContext:myAppdelObject.Obj_xmppManager.moc];
[fetchRequest setEntity:entity];
NSError *error;
NSArray *items = [mocObject executeFetchRequest:fetchRequest error:&error];
for (NSManagedObject *managedObject in items) {
[mocObject deleteObject:managedObject];
}
+4
source to share