I have been trying to use the background upload of NSURLSession, but occasionally I get this crash
Sep 25 10:01:48 ipad backboardd[29] <Warning>: MyApp[11829] has active assertions beyond permitted time:
{(
<BKProcessAssertion: 0x166b1770> identifier: com.apple.nsnetworkd.handlesession process: MyApp[11829] permittedBackgroundDuration: 30.000000 reason: backgroundDownload owner pid:8440 preventSuspend preventThrottleDownUI preventIdleSleep preventSuspendOnSleep
)}
Debugging the code, I figured out that when the crash happens, the application: handleEventsForBackgroundURLSession:completionHandler:
method is called, where I recreate the session and store the completion handler like Apple Documentation reccomends, but the delegates of the task end are never called, and neither is URLSessionDidFinishEventsForBackgroundURLSession:
, which explains the crash, because I call the completion handler after I processed the end of the upload in a NSURLSession delegate.
Can anyone tell me why the delegates aren't called?