Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>NSError *error = nil; NSArray *array = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&amp;error]; NSLog(@"Your data - %@",array); </code></pre> <p>Now you can get it according to data format.</p> <p><strong>EDIT</strong></p> <p>I think you also dont know how to get a <code>webResponse</code>.<br> So here is a way to get <code>webResponse</code> - First set <code>XML</code> delegate in your <code>ViewController.h</code> class and declare a <code>NSMutableData</code> globaly</p> <pre><code>@interface ViewController : UIViewController&lt;NSXMLParserDelegate&gt; @property(nonatomic, retain)NSMutableData *responseData; @end </code></pre> <p>Now synthesized this <code>responseData</code> in your <code>ViewController.m</code> class</p> <pre><code>@synthesize responseData = _responseData; </code></pre> <p>Now you can send <code>request</code> on server in <code>viewDidLoad:</code> method its up to you in which method you want to send it.</p> <pre><code>-(void)viewDidLoad { NSString *urlString = [NSString stringWithFormat:@"http://EnterYourURLHere"]; NSURL *URL = [NSURL URLWithString:urlString]; NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc]init]; [urlRequest setURL:URL]; [urlRequest setHTTPMethod:@"POST"]; [urlRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-type"]; NSURLConnection *urlConnection = [[NSURLConnection alloc]initWithRequest:urlRequest delegate:self]; if(!urlConnection) { [[[UIAlertView alloc]initWithTitle:@"OOoopppssS !!" message:@"There is an error occured. Please check your internet connection or try again." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show]; } } #pragma mark - Parsing delegate methods -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { self.responseData = [[NSMutableData alloc]init]; [self.responseData setLength:0]; } -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [self.responseData appendData:data]; } -(void)connectionDidFinishLoading:(NSURLConnection *)connection { //Now parse your data here - NSError *error = nil; NSArray *array = [NSJSONSerialization JSONObjectWithData:self.responseData options:NSJSONReadingMutableContainers error:&amp;error]; NSLog(@"Your data - %@",array); } </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