-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shouldn't the default cache folder be /library or /documents not /library/caches? #179
Comments
@RamblinWreck77 Hi! Using Documents directory to store cache files is not good idea, because if you will enable iTunes File Sharing Option in you application user will see your caches files. However apple provided another directory for storing application related files which is also will be backed up in iCloud - Library/Application Support. Just create here folder for your data and store them. |
Awesome! Thanks for the quick reply @IgorBulyga ! This folder should persist for application updates and be available in the background right? |
ah this seems to be same issue that I am having #180 Question: Library/Application safe to store user sensitive information? Such user phone number, email address etc? |
@RamblinWreck77 Yes, like Apple Documentation says
@john1452 I suppose it would be safe BUT it would be better to store user sensitive data in keychain. |
@IgorBulyga Keychain was my initial go-to for recovering user fingerprints. The issue is keychain has serious problems when in the background (see evgenyneu/keychain-swift#15) At my scale tens of thousands of sessions a day fail to recover their user session data while in the background, hence using cache as a backup for that scenario. |
Update: I've had this fix out for ~2 weeks now and am not seeing a drop off in background file-not-found. I'm at a loss for what could be causing this... |
@RamblinWreck77 Hi, I 've made a refactoring here #189 and address your issue. You can still use DiskConfig to customise directory path, and from now on, document directory is used by default |
@onmyway133 Hi, I suppose it is not good idea. Because Documents directory is used for user information and it could be visible to user if application supports iTunes File Sharing, besides now cache folder will be changed folder for applications which are using library and they will recache everything what was cached. Maybe it would be better leave cache directory by default and who will not want use it could change it in config? |
@IgorBulyga After discussion, I think you're right. We will use Cache directory for now |
So I've been chasing a weird issue and I think I've gotten to the bottom of it. My app launches in the background periodically and I need to recover user data. After some logging it appeared my users were being logged out way too often/not having user credentials frequently.
So keychain periodically (~5%) of the time fails in the background (longstanding iOS issue), so I store a backup copy in cache to catch it.
Thing is, periodically cache fails too (with a not-found error for a user that definitely exists, and successfully wrote some info to disk)
I discovered that the default directory is Library/Caches, and according to:
https://stackoverflow.com/questions/7155964/will-application-home-library-caches-be-clear-on-app-update
and various other places iOS can periodically clear those files.
This seems counter-intuitive as I would expect most devs to expect a .never expiry to not be at risk of deletion from the OS itself.
All in all it's not a big deal to switch to /Documents (it's nice that this will be backed up by itunes/icloud... library/caches is not!) I am wondering if a change to the default location wouldn't make sense.
Thanks for such a great tool!
Edit: For those who find this later, the correct folder for this is Library/Application Support. I will update this post if moving to this folder solves my issue. I have a build rolling out now that uses the new location so I will see if this fixes my primary issue.
The text was updated successfully, but these errors were encountered: