Not getting unavailable presence of User A when Us

2019-07-18 10:43发布

问题:

I am working on a chat application. I am adding functionality to get unavailable status of the user. Following the situation where i am not getting the unavailable presence of the user

There are 2 users User A and user B and both are available

First User A goes unavailable and User b gets unavailable presence of User A , so its working fine, Then user B goes unavailable and then User A become available here problems occur the User A does not receive offline Unavailable presence of User B.

But when User A is Unavailable and then user B become available and then User A become available then in that case USer A is getting offline available presence of User B so its working fine.

So here the problem is only in case of offline unavailable presence of other users are not coming. but offline available presence are coming

below is the code i am using for going available and unavailable

 - (void)goOnline {
     XMPPPresence *presence = [XMPPPresence presence]; // type="available" is implicit
 [[self xmppStream] sendElement:presence];
}

- (void)goOffline {
XMPPPresence *presence = [XMPPPresence presenceWithType:@"unavailable"];
[[self xmppStream] sendElement:presence];

}

Thanks in advance of any kind of help in this :-)