iOS Development--xmppframewok framework based on XMPP Protocol (III): User Registration

Source: Internet
Author: User

And then it says,

User registration is relatively simple, successfully connected to the server, set up a good jid, you can call

[_xmppstream registerwithpassword:pwd Error:&err]

To register

-(BOOL) RegisterUser: (nsstring*) User withpassword: (nsstring*) pwd{User= [NSString stringWithFormat:@"%@@%@", User,_xmppstream.hostname]; if(![_xmppstream isconnected])    {[self connect:user withpassword:nil]; } [_xmppstream Setmyjid:[xmppjid jidwithstring:user resource:@"iOS"]]; Nserror*err; if([_xmppstream registerwithpassword:pwd error:&Err]) {returnYES;} Else{returnNO;} }

Registration results returned

///Registration Successful- (void) Xmppstreamdidregister: (Xmppstream *) sender{[[Nsuserdefaults standarduserdefaults] SetObject:sender.myJID.user Forkey:kxmppmyjid];    [_maincontroller SetuserLabel:sender.myJID.user];    [_navigateioncontroller Poptorootviewcontrolleranimated:yes];    [_maincontroller Setregisterresult:yes]; NSLog (@"Successful Account Registration"); [Self goonline];}///Registration Failed- (void) Xmppstream: (Xmppstream *) sender Didnotregister: (Nsxmlelement *) error{[_maincontroller Setregisterresult:no]; NSLog (@"Account registration failed"); NSLog (@"%@", error);}

iOS Development--xmppframewok framework based on XMPP Protocol (III): User Registration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.