iosnsurlsessiondownloadtask

NSURLErrorDomain Code=-997 "Lost connection to background transfer service"


I am using NSURLSession to download some mp3 files and store them in the device. Everything works fine but sometimes out of the blue, the app crashes and i get this weird error saying NSURLErrorDomain Code=-997 "Lost connection to background transfer service". It does not happen alot but when it does it just messes up the whole app, like when i launch the app the next time all the download tasks are messed up and i just have to rebuild the application on the device to get it to work again. Note that i only get this error since using Xcode 6 and ios8, even though I'm not sure its is related to ios8 or not.

This is the complete error description:

Error Domain=NSURLErrorDomain Code=-997 "Lost connection to background transfer service" UserInfo=0x178664100 {NSErrorFailingURLKey=http://XXXXXXXXXX.mp3, NSLocalizedDescription=Lost connection to background transfer service, NSErrorFailingURLStringKey=http://XXXXXXXXXXX.mp3}

Solution

  • What version of the SDK are you on? There was a bug in the background transfer daemon that could cause it to crash, which has since been fixed. I would download the latest Xcode beta and try it again.