title: how to get all contacts from XMPP server
body: <p>I am working on a chat application on IOS, I'm trying to fetch the contacts from the XMPP server, but suddenly i am unable to fetch any contacts from the XMPP server. 
  I'm using the following code to fetch the contacts from the server:</p>
  
  <pre><code>(IBAction)sendRequest:(id)sender 
  {
       self.btnContacts.userInteractionEnabled=false;
       [self disableUI];
       //To Search Peticular User either by using their name, email or username
       NSString *userBare1  = [[[[self appDelegate] xmppStream] myJID] bare];
       NSXMLElement *query = [NSXMLElement elementWithName:@"query"];
       [query addAttributeWithName:@"xmlns" stringValue:@"jabber:iq:search"];
  
       NSXMLElement *x = [NSXMLElement elementWithName:@"x" xmlns:@"jabber:x:data"];
       [x addAttributeWithName:@"type" stringValue:@"submit"];
  
       NSXMLElement *formType = [NSXMLElement elementWithName:@"field"];
       [formType addAttributeWithName:@"type" stringValue:@"hidden"];
       [formType addAttributeWithName:@"var" stringValue:@"FORM_TYPE"];
       [formType addChild:[NSXMLElement elementWithName:@"value" stringValue:@"jabber:iq:search" ]];
  
       NSXMLElement *userName = [NSXMLElement elementWithName:@"field"];
       [userName addAttributeWithName:@"var" stringValue:@"Username"];
       [userName addChild:[NSXMLElement elementWithName:@"value" stringValue:@"1" ]];
  
       NSXMLElement *name = [NSXMLElement elementWithName:@"field"];
       [name addAttributeWithName:@"var" stringValue:@"Name"];
       [name addChild:[NSXMLElement elementWithName:@"value" stringValue:@"1"]];
  
       NSXMLElement *email = [NSXMLElement elementWithName:@"field"];
       [email addAttributeWithName:@"var" stringValue:@"Email"];
       [email addChild:[NSXMLElement elementWithName:@"value" stringValue:@"1"]];
  
       //Here in the place of SearchString we have to provide registered user name or emailid or username(if it matches in Server it provide registered user details otherwise Server provides response as empty)
       NSXMLElement *search = [NSXMLElement elementWithName:@"field"];
       [search addAttributeWithName:@"var" stringValue:@"search"];
       [search addChild:[NSXMLElement elementWithName:@"value" stringValue:[NSString stringWithFormat:@"%@",@"*"]]];
  
       [x addChild:formType];
       [x addChild:userName];
       [x addChild:name];
       [x addChild:email];
       [x addChild:search];
       [query addChild:x];
  
       NSXMLElement *iq = [NSXMLElement elementWithName:@"iq"];
       [iq addAttributeWithName:@"type" stringValue:@"set"];
       [iq addAttributeWithName:@"id" stringValue:@"searchByUserName"];
       [iq addAttributeWithName:@"to" stringValue:[NSString stringWithFormat:@"search.%@",@"server name"]];
       [iq addAttributeWithName:@"from" stringValue:userBare1];
       [iq addChild:query];
       [[[self appDelegate] xmppStream] sendElement:iq];
  }
  </code></pre>