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