title: XMPPFramework - How to register a new user account
body: <p>I'm trying to use XMPPFramework to connect to an Openfire server and create a new user account.  If I am already logged in as a different user, this code will create a new user account:</p>
  
  <pre><code>NSXMLElement *query = [NSXMLElement elementWithName:@"query" xmlns:@"jabber:iq:register"];
  [query addChild:[NSXMLElement elementWithName:@"username" stringValue:userName]];
  [query addChild:[NSXMLElement elementWithName:@"password" stringValue:pswd]];
  NSXMLElement *iq = [NSXMLElement elementWithName:@"iq"];
  [iq addAttributeWithName:@"type" stringValue:@"set"];
  [iq addAttributeWithName:@"id" stringValue:@"reg2"];
  [iq addChild:query];
  [xmppStream sendElement:iq];
  </code></pre>
  
  <p>Now what I want to do is make a connection to the server and create the user account WITHOUT first being connected as a different user.  I've tried setting the hostname in xmppStream and making a connection (as below), but that fails to connect.  </p>
  
  <pre><code>NSXMLElement *query = [NSXMLElement elementWithName:@"query" xmlns:@"jabber:iq:register"];
  [query addChild:[NSXMLElement elementWithName:@"username" stringValue:userName]];
  [query addChild:[NSXMLElement elementWithName:@"password" stringValue:pswd]];
  NSXMLElement *iq = [NSXMLElement elementWithName:@"iq"];
  [iq addAttributeWithName:@"type" stringValue:@"set"];
  [iq addAttributeWithName:@"id" stringValue:@"reg2"];
  [iq addChild:query];
  [xmppStream sendElement:iq];
  
  [xmppStream setHostName:@"192.168.1.5"];
  [xmppStream setHostPort:5222];
  NSError *error;
  if (![xmppStream connectWithTimeout:XMPPStreamTimeoutNone error:&amp;error]) {
      UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error connecting"
                                                          message:@"See console for error details."
                                                         delegate:nil
                                                cancelButtonTitle:@"Ok"
                                                otherButtonTitles:nil];
      [alertView show];
  }
  </code></pre>
  
  <p>Any ideas on how can I get this to connect and register the new user?</p>