Downloading Large File using AFNetworking fails when device with passcode enabled locked

Hello all, I am trying to download a large file from a server using AFNetworking with NSURLSessionConfiguration backgroundSessionConfiguration. The download start and succeed when app is in foreground. The download process still succeed if the app goes to background. If the device is configured without a passcode, the download still succeed even if the device got locked while downloading the large file. The download process gets interrupted and fails when the device is configured with a passcode and locked. The issue happen with both iOS 7 and iOS 8. Any help is appreciated to solve this issue? Here is the error description that I receive when such failure happen: Error Domain=NSPOSIXErrorDomain Code=1 "The operation couldn’t be completed. Operation not permitted" UserInfo=0x166378d0 {NSErrorFailingURLKey=https://webp.googlecode.com/files/webp-samples.zip, NSErrorFailingURLStringKey=https://webp.googlecode.com/files/webp-samples.zip}

Answered by DTS Engineer in 12036022

The most likely cause of this is file protection. I posted about this in a thread in the old DevForums.


<https://devforums.apple.com/message/807457#807457>


Share and Enjoy

--

Quinn "The Eskimo!"

Apple Developer Relations, Developer Technical Support, Core OS/Hardware

Accepted Answer

The most likely cause of this is file protection. I posted about this in a thread in the old DevForums.


<https://devforums.apple.com/message/807457#807457>


Share and Enjoy

--

Quinn "The Eskimo!"

Apple Developer Relations, Developer Technical Support, Core OS/Hardware

Hello Quinn, thank you for the quick response. I had to change the file protection mode in the provisionning profile from NSFileProtectionComplete to NSFileProtectionCompleteUntilFirstUserAuthentication and the problem is fixed now.

Downloading Large File using AFNetworking fails when device with passcode enabled locked
 
 
Q