UPDATE
Works in iOS9 Beta 5
ORIGINAL QUESTION
Executing this line of code causes an EXC_BAD_ACCESS error to happen shortly after in some library code on a non-main thread before the completion handler is called.
[[[NSURLSession sharedSession] downloadTaskWithURL:[NSURL URLWithString: @"https://www.google.com/images/srpr/logo11w.png"]
completionHandler:^(NSURL *location,
NSURLResponse *response,
NSError *error) {
NSLog(@"At Download Completion Handler");
}] resume];
It happens on my iPad model A1403 on iOS 9 Beta 3 and 4, but not on iOS8.1, and works fine on my iPad model A1566 on both iOS 9 and iOS 8.4.
I've logged a bug with Apple.
Is anyone else having this issue? Does anyone see a workaround?
Tests:
- iOS 8.1 - device A1566 - working
- iOS 8.4 - device A1403 - working
- iOS 9 beta 4 - simulator - working
- iOS 9 beta 4 - device A1566 - working
- iOS 9 beta 3 - device A1403 - NOT WORKING
- iOS 9 beta 4 - device A1403 - NOT WORKING
Testing by Tander:
- iOS 8.3 - device - working
- iOS 9 beta 0 - simulator - working
- iOS 9 beta 4 - device - working
So the problem is really only occurring on device A1403 with iOS 9...
So I have tested this bit of code for you on the following versions of iOS:
8,3
(device)9.0
(Simulator) and9.4
(Device) - thecompletionHandler
always executes and the log is printed out on all test devices. Not a bug it would seem. Are you testing on an actual device(s) ?