5
votes

Setup

I'm sending a friend / roster request using this code:

[[[XMPPController sharedObject] roster] addUser:[XMPPJID jidWithString:[user stringByAppendingString:@"@server.com"]] withNickname:nil];

and I can confirm that in the ejabberd Web Admin control panel, the request is sent. Also, the request is returned in the stream delegate method:

- (BOOL)xmppStream:(XMPPStream *)sender didReceiveIQ:(XMPPIQ *)iq

as confirmation.

I've read across multiple questions here that the request should be handled in the delegate method:

- (void)xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)presence

alternatively

- (void)xmppRoster:(XMPPRoster *)sender didReceivePresenceSubscriptionRequest:(XMPPPresence *)presence

The Issue

The issue is that neither of these methods get called once a request is send.

Tested on

  • iPhone 5 (iOS 9.3.1)
  • iPhone Simulator (iOS 9.3)

Sending from either devices yields no success.

Notes

I can confirm that the friend request is send, because it is visible in the ejabberd admin panel. Additionally, if a user is added from the admin panel, nothing happens on the client side (The one that should receive the request, that is.).

1

1 Answers

2
votes

The method - (void)xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)presence or - (void)xmppRoster:(XMPPRoster *)sender didReceivePresenceSubscriptionRequest:(XMPPPresence *)presence are not being called because you are not sending anyXMPPPresence.