Getting Roster from XMPP in Swift -


hi new iphone development , don't know in objective c. developing application using swift. added xmpp framework in project , xmpp connection successful. using following code set connection

func setupstream () {          xmppstream = xmppstream()         xmppstream!.adddelegate(self, delegatequeue: dispatch_get_main_queue())         xmppreconnect = xmppreconnect();         xmpprosterstorage = xmpprostercoredatastorage();         xmpproster = xmpproster(rosterstorage: xmpprosterstorage);            xmppvcardstorage = xmppvcardcoredatastorage.sharedinstance();         xmppvcardtempmodule = xmppvcardtempmodule(withvcardstorage:xmppvcardstorage);          xmppvcardavatarmodule = xmppvcardavatarmodule(withvcardtempmodule:xmppvcardtempmodule);          xmppcapabilitiesstorage = xmppcapabilitiescoredatastorage.sharedinstance();         xmppcapabilities = xmppcapabilities(capabilitiesstorage: xmppcapabilitiesstorage);          // set xmpp modules         xmpproster!.autofetchroster = true;         xmpproster!.autoacceptknownpresencesubscriptionrequests = true;          xmppcapabilities!.autofetchhashedcapabilities = true;         xmppcapabilities!.autofetchnonhashedcapabilities = true;          xmppmessagearchivingstorage = xmppmessagearchivingcoredatastorage.sharedinstance();         xmppmessagearchivingmodule = xmppmessagearchiving(messagearchivingstorage: xmppmessagearchivingstorage);         xmppmessagearchivingmodule!.clientsidemessagearchivingonly = true;           // activate xmpp modules         xmppreconnect!.activate(xmppstream);         xmpproster!.activate(xmppstream);         xmppvcardtempmodule!.activate(xmppstream);         xmppvcardavatarmodule!.activate(xmppstream);         xmppcapabilities!.activate(xmppstream);         xmppmessagearchivingmodule!.activate(xmppstream);           xmpproster!.adddelegate(self, delegatequeue:dispatch_get_main_queue());         xmppmessagearchivingmodule!.adddelegate(self, delegatequeue:dispatch_get_main_queue());             } 

and following methods working fine

func xmppstream(sender: xmppstream?, didreceivemessage: xmppmessage?) { }   func xmppstream(sender: xmppstream?, didreceivepresence: xmpppresence?) { } 

now want roster list xmpp. found delegate method in roster class

(void)xmpprosterdidendpopulating:(xmpproster *)sender; 

but how use in swift class. please me....

finally got asnwer setting delegate this

func xmpprosterdidendpopulating(sender: xmpproster?){         var jidlist = xmpprosterstorage?.jidsforxmppstream(xmppstream)         println("list=\(jidlist)")      } 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -