I am trying to execute an asynchronous URL request:
NSURLRequest* request=[NSURLRequest requestWithURL: [NSURL URLWithString: @"http://www.youtube.com/"]];
NSOperation* operation=[NSOperation new];
NSOperationQueue* queue=[NSOperationQueue new];
[operation setCompletionBlock: ^()
{
}];
[queue addOperation: operation];
[NSURLConnection sendAsynchronousRequest: request queue: queue completionHandler: ^(NSURLResponse* response, NSData* data, NSError* error)
{
NSLog(@"%@",[data bytes]);
}];
So I just need the data contained in the URL.But after few seconds (probably in the time that the newly created thread loads the data) the application crashes:
thread 6 : EXC_BAD_ACCESS (code=13, address=0x0)
The exact point is objc_msgSend_vtable5, in the NSLog line, when I try to print data bytes. PS: I'm using ARC.