1
#import <Foundation/Foundation.h>

main() {
        NSURL *url = [NSURL URLWithString:@"http://www.google.com/"]; 
        NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url                
            cachePolicy:NSURLRequestReloadIgnoringCacheData  
                timeoutInterval:60]; 

        NSURLResponse *response; 
        NSError *error; 
        NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; 
        NSLog(@"Data were download below:\n%@", [[NSString alloc] initWithData:data encoding: NSASCIIStringEncoding]); 
}

run the executable -> Data were download below: [null]

Why?

sof
  • 9,113
  • 16
  • 57
  • 83

1 Answers1

0

Have you tried allocating the request and error?

NSURLResponse *response = [[NSURLResponce alloc] init];

NSError *error = [[NSError alloc] init];

James
  • 156
  • 7