Synchronous Request

suggest change

sendSynchronousRequest blocks the thread that calls it. Do not call it on the main thread. It was deprecated in iOS 9. App Transport Security blocks this http URL. URLWithString: is nil for a string that is not a URL.

NSURLRequest * urlRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://google.com"]];
NSURLResponse * response = nil;
NSError * error = nil;
NSData * data = [NSURLConnection sendSynchronousRequest:urlRequest
                                          returningResponse:&response
                                                      error:&error];
    
if (error == nil)
{
    // Parse data here
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents