1

I have following web service url:

NSString *url = @"https://api.parse.com/1/classes/Cinema?keys=name,rows,column&where={\"location\":{\"__type\":\"Pointer\",\"className\":\"Location\",\"objectId\":\"gSEpGR28iT\"}}";

here parameter for where is itself in JSON format

Problem is when i consume this web service using following code it gives error:

NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]];
request.HTTPMethod = @"GET";
[request addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request addValue:PARSE_APPLICATION_ID_VALUE forHTTPHeaderField:PARSE_APPLICATION_ID_KEY];
[request addValue:PARSE_REST_ID_VALUE forHTTPHeaderField:PARSE_REST_ID_KEY];
[NSURLConnection sendAsynchronousRequest:command.request
                                   queue:self.operationQueue
                       completionHandler:^(NSURLResponse *response,
                                           NSData *data,
                                           NSError *error)
 {
   ...
 }]

Error: Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo={NSUnderlyingError=0x7c989590 {Error Domain=kCFErrorDomainCFNetwork Code=-1002 "unsupported URL" UserInfo={NSLocalizedDescription=unsupported URL}}, NSLocalizedDescription=unsupported URL}

If i use same web service without where parameter i.e. only https://api.parse.com/1/classes/Cinema?keys=name,rows,column code works fine. I don't know why a parameter in json format is causing problem. Any help would be highly appreciated. Thanks.

Haroldo Gondim
  • 7,725
  • 9
  • 43
  • 62
Usama
  • 1,945
  • 1
  • 13
  • 20

0 Answers0