growthbook / growthbook-swift

GrowthBook iOS (Swift) SDK
MIT License
13 stars 19 forks source link

Cache is empty after application update. #37

Closed yuryks closed 8 months ago

yuryks commented 1 year ago

Problem: After the application update from the AppStore feature cache is empty on the first launch till SDK re-fetch a new JSON from the server. If the application prepares features on launch - the user will see an invalid application state.

Why this may occur: Currently, the cache is stored in Library/Caches/.

Documentation says: Note that the system may delete the Caches/ directory to free up disk space, so your app must be able to re-create or download these files as needed. Link to doc

So anytime the system decides to clear the Caches directory - we have empty features cache.

Suggestion:

Screenshot 2023-07-05 at 08 28 36
vazarkevych commented 1 year ago

Hello @yuryks , Thank you for bringing this critical issue to our attention. Your detailed explanation helped us understand the problem of feature cache being empty upon the first launch after an AppStore update, due to the system potentially clearing the Caches directory. We've looked into your suggestions and are taking steps to address the issue. Specifically, we are considering: • Moving the SDK cache to a more reliable directory, while also providing a manual clear method for added flexibility. • Adding the ability to configure the cache location in the SDK, to make it more adaptable to different use-cases. We are currently working on implementing these changes and will include them in the next release. Once the new version is available, you'll be able to maintain a consistent application state, even after updates from the AppStore. Your feedback has been invaluable in helping us improve the stability and functionality of our SDK. Please update to the latest version once it's available and let us know if the changes have resolved the issue or if you encounter any other problems.

yuryks commented 1 year ago

@vazarkevych thanks for the quick fix. I have already implemented a temporary fix for our application, but also I will update the SDK to the latest version to check everything works as expected.