mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
AddStorage not working? #191
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 @shift00 on GitHub (Dec 7, 2017).
I have small issue with my project and CoreStore. I need to have sqlite db on start of my app.
At didFinishLauchingWithOptions AppDelegate function I have this code:
let dataStack: DataStack = DataStack( CoreStoreSchema( modelVersion: "V1", entities: [ Entity<Entity1CSModel>("Entity1"), Entity<Entity2CSModel>("Entity2"), Entity<Entity3Model>("Entity3") ] ) )CoreStore.defaultStack = dataStackCoreStore.addStorage( SQLiteStore(fileName: "MyDatabase.sqlite"), completion: { (result) -> Void in print("test") } )I noticed that completion handler is not called what throws the application when I want to create a new Entity1 entity.
@shift00 commented on GitHub (Dec 7, 2017):
When I want to create/edit my entity I receive this error:
@JohnEstropia commented on GitHub (Dec 7, 2017):
addStorage()is an asynchronous operation. Are you sure that yourcreate()call is not being called before theaddStorage()completes?@shift00 commented on GitHub (Dec 7, 2017):
@JohnEstropia I moved block of code when is executed after
addStorage()into completion handler and it's working ;) Thanks for tip 👍@JohnEstropia commented on GitHub (Dec 7, 2017):
That's great to hear :)