I've been trying to get my iOS app to cache data to a place where the user cannot access it directly but it stays cached until the user chooses to clear it.
The ideal solution would be to a place where it appears in Settings > iPhone Storage > AppName > Recommendations although I already provide a mechanism to clear it from within the app so that is not necessarily required.
At the moment I'm caching the data to:
Which resolves to:
However, what I'm seeing is that the XXX part of the Data/Application/XXX/Documents path changes on each execution. Firstly, I'm not sure whether that's related to the simulator specifically or whether it's the same behaviour for an installed app on a device. I'm seeing that the cached data disappears (intermittently) between executions of the app on a device so I suspect it's the same.
What is the recommended way to cache data so
1) it's not directly accessible to the users
2) it appears in the Settings > iPhone Storage > AppName > Recommendations section
3) it stays cached until the user specifically choose to clear it (either from the app or the Recommendations section)