App share Extention ios : How to use GET/POST webservice

134 views Asked by At

I am trying to call a webservice in APP SHARE EXTENSION using GET, display its content in tableview. When user taps on any cell, some string will be send using POST webservice.

I am trying to do this way:

dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(queue, ^{
    NSError *error = nil;
    NSURL *url = [NSURL URLWithString:@"http://www.somename/secure/category"];
    NSString *json = [NSString stringWithContentsOfURL:url
                                              encoding:NSASCIIStringEncoding
                                                 error:&error];
    NSLog(@"\nJSON: %@ \n Error: %@", json, error);
});

But I am getting nil. Please provide the best way to do this.

0

There are 0 answers