Post not yet marked as solved
Post marked as unsolved with 14 replies, 4,937 views
When a batch of download tasks create and resume, some of them are still downloading. Xcode kill the app, and launch app again, then all the tasks failed immediately(if not reproduce, retry these steps). The worst thing is whenever i add new tasks and resume, all of them failed immediately, until i restart the app.I can produce this bug everytime, just follow these tips:NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:@"***"];NSOperationQueue* operationQueue = [[NSOperationQueue alloc] init];operationQueue.maxConcurrentOperationCount = 1;urlsession = [NSURLSession sessionWithConfiguration:configuration delegate:self delegateQueue:operationQueue];for (int i = 0; i < 100; i++){ NSURLSessionDownloadTask* downloadTask = [urlsession downloadTaskWithRequest:urlRequest]; [ downloadTask resume];}Xcode kill the app...Xcode launch app again...The only delegate method be called immediately is:- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)errorError Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={NSErrorFailingURLKey=xx'xx'x'xxxx, NSErrorFailingURLStringKey=***}It's not certain appearing on devices not kill by xcode, but my QA colleagues sometimes got this bug and report to me.Only background session has this bug, defaultSessionConfiguration won't happen.I don't know why "No such file or directory" error is called back, any suggestions?