XMPPFramework - Receive Duplicate Messages

I am using XMPPFramework for iOS.

My problem is that when I join a room, leave it and join it again, I receive messages from this room or private messages in this room twice. If I leave her and join her again, I get her 3 times, etc.

I was told that I can register several delegates and not delete them, but if I do this, I do it by accident, and I'm not quite sure where this is happening. Can anyone help find where this is happening? Maybe an example will help me find it in my code.

Thanks.

+4
source share
2 answers

Just in case, someone likes to know.

The right way to leave a room is to make this feature set:

[xmppRoom leaveRoom]; [xmppRoom deactivate]; [xmppRoom removeDelegate:self]; 
+7
source

I have a problem with the remoteTimestamp value. I solve the problem by adding a workaround to the file: Extensions / XEP -0045 / CoreDataStorage / XMPPRoomCoreDataStorage.m

front:

 - (BOOL)existsMessage:(XMPPMessage *)message forRoom:(XMPPRoom *)room stream:(XMPPStream *)xmppStream { NSDate *remoteTimestamp = [message delayedDeliveryDate]; if (remoteTimestamp == nil) { return NO; } NSManagedObjectContext *moc = [self managedObjectContext]; ...... } 

after

  - (BOOL)existsMessage:(XMPPMessage *)message forRoom:(XMPPRoom *)room stream:(XMPPStream *)xmppStream { NSDate *remoteTimestamp = [message delayedDeliveryDate]; if (remoteTimestamp == nil) { return NO; } remoteTimestamp = nil; NSManagedObjectContext *moc = [self managedObjectContext]; ...... } 
0
source

Source: https://habr.com/ru/post/1391231/


All Articles