iOS15 show you don’t have permission to access “Caches” with Newstand download

my app is newsstand app.

it is success download issue in my app with iOS14 & iOS15 simulate.

when i try on real device, it fail to download.

log

Error Domain=NSCocoaErrorDomain Code=513 "“1318303744724624100” couldn’t be moved because you don’t have permission to access “Caches”." UserInfo={NSSourceFilePathErrorKey=/var/mobile/Media/Downloads/7803184277104936561/1318303744724624100, NSUserStringVariant=(
  Move
), NSDestinationFilePath=/private/var/mobile/Containers/Data/Application/1C6FE6AF-1670-48ED-BE04-2806C8AECC65/Library/Caches/bgdl-4119-6c4a7ac1c9c0c671.xzip, NSFilePath=/var/mobile/Media/Downloads/7803184277104936561/1318303744724624100, NSUnderlyingError=0x282aa3d80 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}

i have set Privacy - Downloads Folder Usage Description in info.plist

please help

Does your app have the data protection entitlement (com.apple.developer.default-data-protection) set? And, if so, what’s it set to?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thanks Quinn,

Have the same problem - download is started, goes to almost the very end and gives the error.

App didn't have data protection entitlement set.

But even after adding data protection entitlement and setting it to NSFileProtectionCompleteUntilFirstUserAuthentication nothing is changed.

Anything else to try, please?

dondontam wrote:

I use NSURLSessionDownloadTask to download

I’m confused. The title of this thread specifically mentions “Newstand download”, which suggests that you’re using the deprecated NewsstandKit framework. Please clarify.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

So is this problem new in iOS 15?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I'm also having this issue.. user gets a dialog about "couldn't be moved because you don't have permission to access "Caches". Is there some extra permission we need to add or something that was broken with the new iOS 15 permissions/setup?

Here is a working code (part of the Baker Framework) where Newsstand's NSURLConnectionDownloadDelegate is replaced with NSURLSessionDownloadTask, thanks: https://github.com/bakerframework/baker/issues/571 You would need to compare it with: https://github.com/bakerframework/baker/blob/master/BakerShelf/BKRIssue.m

everything works well until device upgraded to iOS 15.

Thanks for confirming that.

And the following is for all the folks on this thread, not just gennady from north york because they seem to have already seen which way the wind is blowing here…

So NewstandKit was officially deprecated in iOS 13, and effectively deprecated when we introduced NSURLSession, with its background session support, back in iOS 7. So, while I understand that it’s super inconvenient that something has come unstuck in iOS 15, it’s not a huge surprise )-:

You could file a bug about this but, honestly, I think you’d be better off spending that time moving forward to silent push and NSURLSession.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I think you’d be better off spending that time moving forward to silent push and NSURLSession.

What does apple recommend doing then? I haven't seen any migration guides on going from NK to silent push? How do we manage the asset download etc.?

I haven't seen any migration guides on going from NK to silent push?

I’m pretty sure that Apple never published such a doc, even back in the day when this transition was more common. You may be able to find something from a third-party out there on the ’net. Make sure you use a wide date range in your search because most folks made this transition years ago.

What does apple recommend doing then?

My memory of NewsstandKit is kinda hazy but IIRC it provided two features:

  • A library of current issues (A)

  • The ability to kick off the download of an issue that proceeded in the background (B)

If I missed something, let me know.

So, there’s no direct replacement for A. My advice would be that you maintain your own infrastructure for this. If you don’t want to do that, you could put it in a CloudKit public database.

Either way, your infrastructure should send your app a silent push notification when a new issue is published so that you can kick off a download. With CloudKit you’d get that for free. If you run your own infrastructure you’ll need to implement a push provider.

This is a big topic, part of the overall push notifications story. You can read all about that here.

With regards B, that’s a very common task and you’ll find lots of docs and articles about it (indeed, gennady from north york posted some links earlier in this thread). The official docs are here and there’s a specific article for Downloading Files in the Background.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

iOS15 show you don’t have permission to access “Caches” with Newstand download
 
 
Q