We too have seen intermittent crashes on the simulator in the following ways :
- Zooming in/out of the map aggressively (iPad 2 simulator only)
- Calling zoomToEnvelope on the map when the view controller loads
- Using AutoPan mode to zoom into the device location
The good news is that so far we haven't seen the crash on a device, but we believe this issue stems from a bug in iOS 8. We have reported the issue to Apple by filing a radar - #18590356 NSURLSession will crash the application.
Following is the code we submitted that reproduces the crash on iOS 8. We have escalated the issue to Apple through our business contact, but I suggest you also file an independent radar to add more weight to the issue.
while (YES) {
@autoreleasepool{
NSURL *url = [NSURL URLWithString:@"http://prod.lists.apple.com/archives/macnetworkprog/2014/Oct/msg00001.html"];
NSURLSessionConfiguration *config = [NSURLSessionConfiguration ephemeralSessionConfiguration];
NSURLSession *session = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:nil];
NSURLSessionDataTask *task =
[session dataTaskWithURL:url
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *error) {
NSLog(@"response: %@", response);
}];
[task resume];
[task cancel];
// *** It is this call to finishTasksAndInvalidate that seems to trigger the crash.
// If I comment it out, no crash.
//[session finishTasksAndInvalidate];
[session invalidateAndCancel];
}
}