Comment puis-je créer un nouveau count user dans XMPPFrameWork dans ios

Salut J'ai essayé du code pour l'logging de nouveaux users en utilisant XMPPFrameWork dans IOS.

-(IBAction)Registaton:(id)sender { // iPhoneXMPPAppDelegate *appDelegate =(iPhoneXMPPAppDelegate *)[[UIApplication sharedApplication]delegate]; [[[self appDelegate] xmppStream] connectWithTimeout:XMPPStreamTimeoutNone error:nil]; NSSsortingng *username = self.username.text; NSSsortingng *password = self.password.text; NSSsortingng *name =self.name.text; NSSsortingng *email=self.email.text; NSMutableArray *elements = [NSMutableArray array]; [elements addObject:[NSXMLElement elementWithName:@"username" ssortingngValue:username]]; [elements addObject:[NSXMLElement elementWithName:@"password" ssortingngValue:password]]; [elements addObject:[NSXMLElement elementWithName:@"name" ssortingngValue:name]]; [elements addObject:[NSXMLElement elementWithName:@"email" ssortingngValue:email]]; [[[self appDelegate] xmppStream] registerWithElements:elements error:nil]; NSLog(@"Register ====%@",[[self appDelegate] xmppStream]); //[[[self appDelegate] xmppStream] registerWithPassword:elements error:nil]; } 

mais grâce à cette méthode, je ne suis pas capable de s'inscrire sur le server. il me donne la connection à Xmppstream S'il vous plaît attendre .. Quelqu'un peut-il m'aider comment puis-je créer un nouveau count sur le server en utilisant XMPPFrameWork dans ios.

Essaye ça. Cela fonctionne bien pour moi

 - (void)updateAccountInfo { //NSSsortingng *domain = [[NSSsortingng alloc] initWithSsortingng:@"192.168.1.100"]; //int port = 5222; NSSsortingng *usname =[[NSSsortingng alloc] initWithSsortingng:self.txtUsername.text]; NSSsortingng *juser =[[NSSsortingng alloc] initWithSsortingng:[usname ssortingngByAppendingSsortingng:@"your server ip"]]; XMPPJID *jid = [XMPPJID jidWithSsortingng:juser]; [self xmppStream].myJID =jid; allowSelfSignedCertificates = NSOnState; allowSSLHostNameMismatch = NSOnState; NSUserDefaults *dflts = [NSUserDefaults standardUserDefaults]; //[dflts setObject:domain forKey:@"Account.Server"]; // [dflts setObject:(port ? [NSNumber numberWithInt:port] : nil) // forKey:@"Account.Port"]; [dflts setObject:juser forKey:@"Account.JID"]; [dflts setObject:@"ios" forKey:@"Account.Resource"]; [dflts setBool:useSSL forKey:@"Account.UseSSL"]; [dflts setBool:allowSelfSignedCertificates forKey:@"Account.AllowSelfSignedCert"]; [dflts setBool:allowSSLHostNameMismatch forKey:@"Account.AllowSSLHostNameMismatch"]; [dflts setBool:YES forKey:@"Account.RememberPassword"]; [dflts setObject:self.txtPasswd.text forKey:@"Account.Password"]; [dflts synchronize]; } - (void)createAccount { [self updateAccountInfo]; NSError *error = nil; BOOL success; if(![[[self appDelegate] xmppStream] isConnected]) { if (useSSL) success = [[self xmppStream] oldSchoolSecureConnectWithTimeout:XMPPStreamTimeoutNone error:&error]; else success = [[self xmppStream] connectWithTimeout:XMPPStreamTimeoutNone error:&error]; } else { //NSSsortingng *password = [[NSSsortingng alloc] initWithSsortingng:@"321" ]; success = [[self xmppStream] registerWithPassword:self.txtPasswd.text error:&error]; } if (success) { [self appDelegate].isRegistering = YES; } else { NSLog(@"not succeed "); } } - (void)xmppStreamDidRegister:(XMPPStream *)sender{ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Registration" message:@"Registration with XMPP Successful!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; [alert show]; } - (void)xmppStream:(XMPPStream *)sender didNotRegister:(NSXMLElement *)error{ DDXMLElement *errorXML = [error elementForName:@"error"]; NSSsortingng *errorCode = [[errorXML atsortingbuteForName:@"code"] ssortingngValue]; NSSsortingng *regError = [NSSsortingng ssortingngWithFormat:@"ERROR :- %@",error.description]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Registration with XMPP Failed!" message:regError delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; if([errorCode isEqualToSsortingng:@"409"]){ [alert setMessage:@"Username Already Exists!"]; } [alert show]; } 

Une approche simple et travaillante qui a travaillé pour moi

 NSSsortingng *username = @"rohit@XMPP_SERVER_IP_HERE"; // OR [NSSsortingng ssortingngWithFormat:@"%@@%@",username,XMPP_BASE_URL]] NSSsortingng *password = @"SOME_PASSWORD"; AppDelegate *del = (AppDelegate *)[[UIApplication sharedApplication] delegate]; del.xmppStream.myJID = [XMPPJID jidWithSsortingng:username]; NSLog(@"Does supports registration %ub ", ); NSLog(@"Attempting registration for username %@",del.xmppStream.myJID.bare); if (del.xmppStream.supportsInBandRegistration) { NSError *error = nil; if (![del.xmppStream registerWithPassword:password error:&error]) { NSLog(@"Oops, I forgot something: %@", error); }else{ NSLog(@"No Error"); } } // You will get delegate called after registrations in either success or failure case. These delegates are in XMPPStream class // - (void)xmppStreamDidRegister:(XMPPStream *)sender //- (void)xmppStream:(XMPPStream *)sender didNotRegister:(NSXMLElement *)error