objective c - How could i add phonebook contacts to my chat app in ios by using xmpp framework and openfire server? -
i new chat application , making in objective-c. wanted know how save phonebook contacts user. know how fetch contacts address book dont have idea xmpp framework , openfire.if me.
first know how fetch contacts.now every contact need add xmpp roaster.like below call method called @ contact fetching class.
[[self appdelegate] addnewbuddytomyaccount:tempnumber withnickname:[[tempcontactlist objectatindex:i] fullname]];
//in terms tempnumber phone number jid.
in xmpp class follow below code add roster nsstring * buddynamejid = [nsstring stringwithformat:@"%@@servername",buddyuserid]; xmppjid *jid = [xmppjid jidwithstring:buddynamejid]; //if don't need permission use below line otherwise comment [[self xmpproster] acceptpresencesubscriptionrequestfrom:jid andaddtoroster:yes]; //here adding our contact our roster check once in roaster in openfire [[self xmpproster] adduser:jid withnickname:nickname];
hope helps.
Comments
Post a Comment