NSURLSession didCompleteWithError: called with NSError, zero

The script takes the application in the background and foreground several times when it is loading, the doCompleteWithError method: is called when the application is taken to the foreground with an error parameter of null. The probability is 1/3.

How to find out what went wrong, because the error parameter gives nothing.

+3
source share
1 answer

The problem is that didCompleteWithError only reports a client-side error, otherwise nil. iOS doc said:

" . , , - , , .

.

,

- URLSession:didBecomeInvalidWithError:

. , NSURLSession :

NSURLSessionConfiguration *backgroundConfigurationObject = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:@"applycasession"];
    self.backgroundSession = [NSURLSession sessionWithConfiguration:backgroundConfigurationObject delegate:self delegateQueue:[NSOperationQueue mainQueue]];

, :

 [self.backgroundSession invalidateAndCancel];

, URL

+3

All Articles