4
votes

I'm developing an XMPP iOS application based on XMPPFramework and an ejabberd Community Edition server and I'm playing around with vCard management.

During my experiments, I've found out that when requesting a vCard for a user via something like:

[vCardTempModule fetchvCardTempForJID:myJID];

Then no delegate method will be called if the user has no vCard on the server.

Is there a way to be 100% sure a user has no vCard via an explicit answer from the server?

Or should I just consider that the user has no vCard after a delay of n seconds without any delegate feedback? (which would be ambiguous with the situation of a network latency that can be very frequent on a mobile environment)

1

1 Answers

2
votes

In XEP-0054 XMPPvCardTempModule.m

You need to do this

- (void)xmppStreamDidAuthenticate:(XMPPStream *)sender {


    XMPPvCardTemp *myvCardTemp = [self myvCardTemp];//check if exist or not

    if (!myvCardTemp)//if not then create a new vcard
    {
        NSXMLElement *vCardXML = [NSXMLElement elementWithName:@"vCard" xmlns:@"vcard-temp"];
        XMPPvCardTemp *newvCardTemp = [XMPPvCardTemp vCardTempFromElement:vCardXML];
        [newvCardTemp setNickname:userName];
        [self updateMyvCardTemp:newvCardTemp];
    }

}

Hope it works for you :)