Problem comes when a new user registers with XMPP. I am unable to set nickname on vCard, however if vCard of a user already exists then same piece of code works fine.
dispatch_queue_t queue = dispatch_queue_create("queue", DISPATCH_QUEUE_PRIORITY_DEFAULT);
dispatch_async(queue, ^{
XMPPvCardCoreDataStorage *xmppvCardStorage = [XMPPvCardCoreDataStorage sharedInstance];
XMPPvCardTempModule *xmppvCardTempModule = [[XMPPvCardTempModule alloc] initWithvCardStorage:xmppvCardStorage];
[xmppvCardTempModule activate:[self xmppStream]];
XMPPvCardTemp *myVcardTemp = [xmppvCardTempModule myvCardTemp];
if (myVcardTemp == nil) {
// I am stuck here, unable to create empty VCard for new User
}
else {
[myVcardTemp setNickname:@"iphone"];
[xmppvCardTempModule updateMyvCardTemp:myVcardTemp];
}
});
Any clue for creating vcard for first time in xmpp?
XMPPvCardTemp *myvCardTemp = [xmppvCardTempModule myvCardTemp];
if (!myvCardTemp)
{
NSXMLElement *vCardXML = [NSXMLElement elementWithName:@"vCard" xmlns:@"vcard-temp"];
XMPPvCardTemp *newvCardTemp = [XMPPvCardTemp vCardTempFromElement:vCardXML];
[newvCardTemp setNickname:@"nick"];
[xmppvCardTempModule updateMyvCardTemp:newvCardTemp];
}
else
{
//Set Values as normal
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With