Skip to content

v1.8.0

Compare
Choose a tag to compare
@krizzu krizzu released this 17 Feb 08:43

❗️ Features - Possible a Breaking Change for iOS Platform ❗️

Note: If you're planning on upgrade, please use v1.8.1 and up.

  • Moved storage location to Application Support. Read the description below to find out more.
    Thanks @HeyImChris ! (#274) 4e49db6

Fixes

  • Don’t reset the storage when the manifest file cannot be read because of iOS data protection.
    Thanks @aleh ! (#270) 36e9a12

v1.7.1...v1.8.0

(iOS) New Locations for storage - new feature overview

So far, Async Storage has used NSDocumentDirectory (and NSCachesDirectory for tvOS) location to store the manifest file, where all data is saved.

NSDocumentDirectory - This folder is visible on iOS in scenarios where you can view the Files structure. For instance, in Word/PPT/Excel, a user can tap through to this and see a folder titled "RCTAsyncLocalStorage_V1".

NSCachesDirectory - Apple documents this as a location that can get purged in low memory scenarios "the system may delete the Caches directory on rare occasions when the system is very low on disk space."

Those two location are not best place to keep user data. The new location, the Application Support directory (NSApplicationSupportDirectory), is described as "[containing] all app-specific data and support files" and it can safely contain user data. There is not risk of this purging in low memory situations and this isn’t visible to iOS users.

This feature also includes a migration process. On app startup, a check is run to see if Application Support contains the manifest file:
- If it does, do nothing
- if it does not, copy over the manifest from previous location (either NSDocumentDirectory or NSCachesDirectory)

This is considered as breaking change, as some dependencies might still use older version of AS or the one available from the React Native core. In that case, both old and new locations are used, so unexpected behavior might occur. Ideally, you’ll want to make sure that only one version of AS is used within your Application.

Thanks @HeyImChris for implementing this feature!