I am facing issue in fetching all registered users in XMPP ios project. I am using openfire.
Below are the code i am using but it always gives me zero in the arraylist.:-
- (BOOL)xmppStream:(XMPPStream *)sender didReceiveIQ:(XMPPIQ *)iq
{
NSXMLElement *queryElement = [iq elementForName: @"query" xmlns: @"jabber:iq:roster"];
if (queryElement)
{
NSArray *itemElements = [queryElement elementsForName: @"item"];
NSMutableArray *mArray = [[NSMutableArray alloc] init];
for (int i=0; i<[itemElements count]; i++)
{
NSString *jid2=[[[itemElements objectAtIndex:i] attributeForName:@"jid"] stringValue];
[mArray addObject:jid2];
}
NSLog(@"didReceiveIQ Array======%@",mArray);
[[NSNotificationCenter defaultCenter] postNotificationName:@"FriendRequestSend" object:nil];
}
return NO;
}
Though i can see 3 users in the browser.
Note: I had seen the post iOS XMPP framework get all registered users
but it does not work.
Please help me and advice me there is mistake in the code