Hi,
I had an assertion error in AFN in AFURLSessionManager.m
which is called by
It seems [self.session uploadTaskWithRequest:request fromFile:fileURL] is returning a nil.
All of the above error happened in background and it is not happening every time.
I checked that self.session is not nil. request seems valid and the file exists at fileURL.
Has anyone had this issue before?
I found that downloadTaskWithRequest also returns nil, I have no idea how it happened.
It looks like this is a bug in iOS. More info here: https://devforums.apple.com/message/926113#926113
I also found this issue that downloadTaskWithRequest returns nil. Anybody knows how to fix?
Anyone have any update on this by chance? Seeing the same thing :(
I tried to fix it by making more attempts to create the task after nil has been returned (https://github.com/denivip/AFNetworking/commit/4872bf2a3ee0d4c8dc5570673b7db1958a04be17). This hasn't fixed the problem completely, but now we get much less of these errors (on the order of 10-100 times less).
Proposed workaround in #2074. Please continue discussion on that thread.
Hi
Today i have a similar bug : after 10 or 20 background downloading, [self.session downloadTaskWithRequest:request] return always nil.
In this case, i modify downloadTaskWithRequest for return nil and the application re-init AFURLSessionManager.
This hack work !
So, when downloadTask is nil, i sugest to re-init the NSURLSession instance before ask for a new download task.
I hope this help you.
I've noticed this seems to be cleaned up in iOS 8. Is anyone else noticing the same?
Most helpful comment
I also found this issue that downloadTaskWithRequest returns nil. Anybody knows how to fix?