title: Objective-C issues with dataTaskWithRequest
body: <p>I have recently switched from sendSynchronousRequest to dataTaskWithRequest</p>
  
  <p>with sendSynchronousRequest my method was working perfectly but when I switch to dataTaskWithRequest I get the following error:</p>
  
  <pre><code>error   NSURLError *    domain: @"NSURLErrorDomain" - code: 4294966096  0x15ee96c0
  </code></pre>
  
  <p>and</p>
  
  <pre><code>myError NSError *   domain: nil - code: 1684370017  0x26cce125
  </code></pre>
  
  <p>I don't understand why.</p>
  
  <p>Here is the old code (commented out) and the new code:</p>
  
  <pre><code>/*-(NSDictionary *)GetProductionScheduleData:(NSString *)areaDescription
  {
      NSString *areaDescriptionWSpaceCharacters = [areaDescription stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
      NSString *requestString = [NSString stringWithFormat:@"%@?areaDescription=%@",kIP,areaDescriptionWSpaceCharacters];
      NSURL *JSONURL = [NSURL URLWithString:requestString];
      NSURLResponse* response = nil;
      NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:JSONURL];
      NSData* data = [NSURLConnection sendSynchronousRequest:request returningResponse:&amp;response error:nil];
      if(data == nil)
          return nil;
      NSError *myError;
      NSDictionary *productionSchedule = [[NSDictionary alloc]initWithDictionary:[NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&amp;myError]];
      return productionSchedule;
  }*/
  
  -(void)GetProductionScheduleData:(NSString *)areaDescription Completetion:(void (^) (NSMutableDictionary * result,NSError * error))completion{
  
      NSString *areaDescriptionWSpaceCharacters = [areaDescription stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
      NSString *requestString = [NSString stringWithFormat:@"%@?areaDescription=%@",kIP,areaDescriptionWSpaceCharacters];
      NSURL *JSONURL = [NSURL URLWithString:requestString];
      NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:JSONURL];
      NSURLSession *session = [NSURLSession sharedSession];
      NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                                  completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
                                        {
                                            NSError *myError;
                                            NSMutableDictionary *productionSchedule = [[NSMutableDictionary alloc]initWithDictionary:[NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&amp;myError]];
  
                                            completion(productionSchedule,myError);
  
                                        }];
      [dataTask resume];
  
  }
  </code></pre>
  
  <p>Please Help! This was working with sendSynchronousRequest I am starting to dislike dataTaskWithRequest.</p>