hardik vyas hardik vyas - 6 months ago 36
Objective-C Question

How to call webService Using NSURLConnection in ios

Actually I am using now JSON classes for calling web-services but now i want to call that webservice using

any one provide me code for that.

Please provide me details of frameworks what i have to import.

Thank you in advance.

NSURL *url = [NSURL URLWithString:stringurl];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
NSOperationQueue *queue = [[NSOperationQueue alloc] init];

[NSURLConnection sendAsynchronousRequest:urlRequest queue:queue completionHandler:^(NSURLResponse response, NSData data, NSError *error)
     NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];

You Can use this.