title: Check whether NSURLConnection not success in  iphone?
body: <pre><code>-(void)loadRequest:(NSString *)jsonString{
  receivedData = [[NSMutableData alloc]init];
  urlString = [[NSString alloc]initWithString:[NSString stringWithFormat:kURL]];
  urlRequest=[NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
     requestInformation =[[NSMutableURLRequest alloc]initWithURL:urlRequest cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:60];
  [requestInformation setValue:khttpValue forHTTPHeaderField:kContentType];
  [requestInformation setValue:@"value1" forHTTPHeaderField:@"key1"];
  
  [requestInformation setHTTPMethod:kPost];
  jsonData= [[NSString stringWithFormat:@"json=%@",jsonString] dataUsingEncoding:NSUTF8StringEncoding];
  [requestInformation setHTTPBody:jsonData];
  
  connection = [[NSURLConnection alloc] initWithRequest:requestInformation delegate:self];
  [connection start];
  if(connection){
      NSLog(@"Connection succesfull");
  }
  else{
      NSLog(@"There is a error in connection");
      [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(onFailedToUpload) userInfo:nil repeats:NO];
  
  }
  }
  </code></pre>
  
  <p>how to check if the else part is executed. I give incorrect URL , didfailwitherror method is called but the else part is not executed.</p>