mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
Crash while trying refetch listMonitor after data stack is recreated. #203
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sidlatau on GitHub (Mar 2, 2018).
Hi, I am recreating database by physically deleting/moving DB files after each login to app.
After file is moved I recreate data stack by calling:
But if ListMonitor was created on old data stack I get crash there:
parentStackthere isnil.This refetch is called from this observer:
I am using CoreStore v5.0.0.
Maybe there is a better way to recreate data stack or only one storage in that stack? I see there is method
storage.cs_eraseStorageAndWaitbut it is specifically indicated not to use it directly.@JohnEstropia commented on GitHub (Apr 14, 2018):
@sidlatau Have you solved your issue? I personally don't recommend moving SQLite files around, but if you really need to, just make sure that
-walfilesListMonitors@sidlatau commented on GitHub (Apr 16, 2018):
No, I haven't solve the issue, I just stopped using
ListMonitors . Despite that issue I am happily using CoreStore :) Thank you for your feedback.@tosbaha commented on GitHub (May 5, 2018):
I had similar problems. I was using AppDelegate to initialize data stack and had
ListMonitorin my main view. The thing is, in storyboard environments, viewDidLoad is called before AppDelegate and this messes up things. I learned my hard lesson that you shouldn't depend on AppDelegate. My approach is something like below@JohnEstropia commented on GitHub (May 7, 2018):
@tosbaha Thanks for the feedback. Your pattern is the best practice as it is explicit about the initialization timing.
I am closing this issue as the OP seems to have gone to a different route to solve the issue.