Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>NSMutableArray *elements = [NSMutableArray array]; [elements addObject:[NSXMLElement elementWithName:@"username" stringValue:@"venkat"]]; [elements addObject:[NSXMLElement elementWithName:@"password" stringValue:@"dfds"]]; [elements addObject:[NSXMLElement elementWithName:@"name" stringValue:@"eref defg"]]; [elements addObject:[NSXMLElement elementWithName:@"accountType" stringValue:@"3"]]; [elements addObject:[NSXMLElement elementWithName:@"deviceToken" stringValue:@"adfg3455bhjdfsdfhhaqjdsjd635n"]]; [elements addObject:[NSXMLElement elementWithName:@"email" stringValue:@"abc@bbc.com"]]; [[[self appDelegate] xmppStream] registerWithElements:elements error:nil]; </code></pre> <p>We will know whether the registration is successful or not using the below delegates.</p> <pre><code>- (void)xmppStreamDidRegister:(XMPPStream *)sender{ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Registration" message:@"Registration Successful!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; [alert show]; } - (void)xmppStream:(XMPPStream *)sender didNotRegister:(NSXMLElement *)error{ DDXMLElement *errorXML = [error elementForName:@"error"]; NSString *errorCode = [[errorXML attributeForName:@"code"] stringValue]; NSString *regError = [NSString stringWithFormat:@"ERROR :- %@",error.description]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Registration Failed!" message:regError delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; if([errorCode isEqualToString:@"409"]){ [alert setMessage:@"Username Already Exists!"]; } [alert show]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload