When i send a async request using the sendAsynchronousRequest method, it returns the null response in the error scenario like 'invalid username'. In the API, i am sending the response, at error scenario with corresponding JSON values.
It receives the JSON, but url response is null.
It works fine when i do this in connectionWithRequest: method with proper delegate methods.
Any help would be much appreciated.
Thanks!
[NSURLConnection sendAsynchronousRequest:request
queue:[[NSOperationQueue alloc] init]
completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
NSLog(@"%@", (NSHTTPURLResponse *)response);
}];
What you are seeing is the expected behaviour.
Straight from the documentation of said method: