Pregunta

I use that code to get it

- (BOOL)xmppStream:(XMPPStream *)sender didReceiveIQ:(XMPPIQ *)iq
NSXMLElement *queryElement = [iq elementForName: @"query" xmlns: @"jabber:iq:roster"];
if (queryElement)
{
    NSArray *itemElements = [queryElement elementsForName: @"item"];
    [self.cts removeAllObjects];
    for (int i=0; i<[itemElements count]; i++)
    {
        NSString *jid = [[[itemElements objectAtIndex:i] attributeForName:@"jid"] stringValue];
        [self.cts addObject:jid];
    }
    NSLog(@"\nRoster ID's %@",self.cts);
}

Problem is that firstly I get roster list but if it changing I get just jID of user that is removed or added in roster list. My purpose to get complete current roster list. How can I do it?

¿Fue útil?

Solución

Since it seems you are using the XMPPFramework - usually the additional information will come in via vCards when they are needed.

If using the CoreData part of the roster (XMPPRosterCoreDataStorage), and you have the roster to be autoFetched, you should get the full roster (depending on the server you are using), and when needed, the vCard for that user (to get the rest of the information).

If you need to get the full one each time, you can tell it manually fetch ([xmppRoster fetchRoster], and it will request a full one (query type get). You can also track these iq's to know when you have received the response to the request (using the XMPPIDTracker).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top