At this stage of the communication service. Various standards are present, and therefore there is an inability to achieve interconnection, whereas the XMPP (extensible Message and Presence Protocol) protocol appears. It realizes the intercommunication of the whole timely Communication service agreement. With this agreement, the use of any organization or individual to provide even communications services can be accessible to other users of the timely communication services. Google Talk, for example, launched in 2005, is an XMPP protocol-based instant messaging software. Let's talk about how to simply use XMPP's friends and personal electronic Business cards
1, in the XMPPFramework.h will need to use the header file open
2. Create an Electronic Business Card page in storyboard
3. Define data storage and vcard model properties and initialize
Electronic Business Card @property (strong,nonatomic) xmppvcardtempmodule * vcardmodule;//vcard storage @property (strong,nonatomic) Xmppvcardcoredatastorage *vcardstorage; Initialize card storage self.vcardstorage=[xmppvcardcoredatastorage sharedinstance]; Initialize the nickname brochure storage Self.rosterstorage=[[xmpprostercoredatastorage alloc] init]; Activating the current Electronic Business card [Self.vcardmodule Activate:self.stream];
4, create the corresponding class, and with the Electronic Card Storyboard Association. Connecting the outputs
5. Get the current people e-card
Get vcard card information i.e. personal information appdelegate * delegate=[uiapplication sharedapplication].delegate; Xmppvcardtemp *vcard = [Delegate.vcardmodule myvcardtemp]; Assuming that the E-card information does not exist need to be set again if (vcard==nil) { vcard=[xmppvcardtemp vcardtemp]; Vcard.nickname=[[nsuserdefaults Standarduserdefaults] objectforkey:@ "UserName"]; } if (vcard.jid==nil) { Xmppjid * Jid=[xmppjid jidwithstring:[[nsuserdefaults standarduserdefaults] objectForKey:@ " UserName "]; Vcard.jid=jid; } Update the changed data [Delegate.vcardmodule Updatemyvcardtemp:vcard];
6. Display the information of the electronic card to the UI interface
Display the information of the vcard to the UI Self.jrimage.image=[uiimage ImageWithData:vcard.photo]; Self.name.text=vcard.nickname; Self.jid.text=vcard.jid.full; Self.email.text=vcard.mailer; Self.company.text=vcard.orgname; Self.depart.text=[vcard.orgunits Firstobject]; Self.post.text=vcard.title; Self.tel.text=vcard.note;
For example, the following:
6, change the electronic card. Involves changes to personal information. Here we need to do the UI again
Click on the change call method to
Update the changed data [Delegate.vcardmodule Updatemyvcardtemp:vcard];
A small partner who wants to learn a lot about other content. You can click to view the source code and perform the test yourself.
Inquiries or technical exchanges. Please add the official QQ Group: (452379712)
Jerry Education
Source:http://blog.csdn.net/jerehedu/
The copyright belongs to Yantai Jerry Education Technology Co., Ltd. and CSDN co-owned, welcome reprint, but without the author's permission must retain this paragraph, and in the article page obvious location to the original link, otherwise reserves the right to pursue legal responsibility.
XMPP Personal Information Display