mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
context.parentStack == nil #253
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 @dufflink on GitHub (Jan 15, 2019).
Hello! I did as you advised #281 but the problem remained the same.
The error occurs only when I log out from the account of one user and immediately try to log in to another user.
@JohnEstropia commented on GitHub (Jan 16, 2019):
You are trying to add your sqlite store to a new DataStack when it is still being used by the old DataStack (CoreStore.defaultStack still holds the old stack)
I recommend that you set your CoreStore.defaultStack to a new DataStack, give the old stack time to release itself, then add the sqlite store to the new stack.
@dufflink commented on GitHub (Jan 16, 2019):
How can i give the old stack time to release itself?
@dufflink commented on GitHub (Jan 17, 2019):
It works for me:
I added a nil check for dataStack
@dufflink commented on GitHub (Jan 18, 2019):
How can I use two different SQLite stores in one data stack? Now, I still have data from another user (Message, Chats)
@JohnEstropia commented on GitHub (Jan 21, 2019):
You will have to release the
DataStackused by your old account. Your old code was fine: https://github.com/JohnEstropia/CoreStore/issues/281#issuecomment-442388594Your issue in #281 is not the database setup code. You have other processes in your app that still use the old DataStack. They may be View Controllers, or something else. That's what you should focus debugging, those objects need to be deallocated before you call
initDb()again with the new account.I'm closing this issue in a while as this is an application-side issue. I assure you that switching DataStacks work, the CoreStore demo app does it (see:
40f458a09c/CoreStoreDemo/CoreStoreDemo/MIgrations%20Demo/MigrationsDemoViewController.swift (L243))@dufflink commented on GitHub (Jan 21, 2019):
Could you share your login in Telegram? Or any other social network
@JohnEstropia commented on GitHub (Jan 21, 2019):
@MaxPaymon I don't have a Telegram account, but CoreStore has a Slack group: http://swift-corestore-slack.herokuapp.com/
I'd be happy to help you where I can. I do suggest you refer to the
MigrationsDemoViewController.swiftin the demo app first, it shows a ViewController that changesDataStackandListMonitorinstances each time you tap on a different model version.@dufflink commented on GitHub (Jan 21, 2019):
Ok, thanks!