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") ] ) )
I noticed that completion handler is not called what throws the application when I want to create a new Entity1 entity.
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 = dataStack`
`CoreStore.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.
When I want to create/edit my entity I receive this error:
[CoreStore: Fatal Error] BaseDataTransaction.swift:83 create
↪︎ Attempted to create an entity of type 'Entity1CSModel', but a destination persistent store containing the entity type could not be found.
@shift00 commented on GitHub (Dec 7, 2017):
When I want to create/edit my entity I receive this error:
```
[CoreStore: Fatal Error] BaseDataTransaction.swift:83 create
↪︎ Attempted to create an entity of type 'Entity1CSModel', but a destination persistent store containing the entity type could not be found.
```
addStorage() is an asynchronous operation. Are you sure that your create() call is not being called before the addStorage() completes?
@JohnEstropia commented on GitHub (Dec 7, 2017):
`addStorage()` is an asynchronous operation. Are you sure that your `create()` call is not being called before the `addStorage()` completes?
@JohnEstropia I moved block of code when is executed after addStorage() into completion handler and it's working ;) Thanks for tip 👍
@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 👍
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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 :)