Re: Crash encountered when calling resume and cancel on a NSURLSessionTask quickly
Re: Crash encountered when calling resume and cancel on a NSURLSessionTask quickly
- Subject: Re: Crash encountered when calling resume and cancel on a NSURLSessionTask quickly
- From: Scott Hancher <email@hidden>
- Date: Mon, 06 Oct 2014 14:25:55 -0700
We found a short and simple piece of code that triggers our crash.
while (YES) {
NSURLSessionConfiguration *config = [NSURLSessionConfiguration ephemeralSessionConfiguration];
NSURLSession *session = [NSURLSession sessionWithConfiguration:config];
NSURLSessionDataTask *task =
[session dataTaskWithURL:url
completionHandler: ^(NSData *data,
NSURLResponse *response,
NSError *error) {
}];
[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];
}
Is there something wrong with calling cancel on a task followed by calling finishTasksAndInvalidate on the session that created it? After calling cancel, we're just trying to correctly cleanup the session, but perhaps we should do nothing.
Please advise. Thank you,
++Scott.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden