Setup without .xcdatamodeld file, in a whole new project #397

Closed
opened 2025-12-29 15:30:56 +01:00 by adam · 2 comments
Owner

Originally created by @AnthoPakPak on GitHub (Nov 24, 2022).

Hey!

Thanks for this lib, which looks promising.
Unfortunately, after reading a good part of the docs, I just can't get it. I want to use CoreStore in a fresh new project (no CoreData enabled at the creation).

My understanding is that CoreStore doesn't need xcdatamodeld files.
But the very first setup line (try CoreStoreDefaults.dataStack.addStorageAndWait()) causes crash because it searches for a momd file.
The error is this one: "Could not find "MyApp.momd" from the bundle "com.anthopak.MyApp". Other model files in bundle: 0 item(s) []".

I've tried several variants of creating the DataStack, all leading to this error. I'm sure I'm missing something, probably obvious, but after several hours of searching I end up asking, because I can't fix it by myself...

Originally created by @AnthoPakPak on GitHub (Nov 24, 2022). Hey! Thanks for this lib, which looks promising. Unfortunately, after reading a good part of the docs, I just can't get it. I want to use CoreStore in a fresh new project (no CoreData enabled at the creation). My understanding is that CoreStore doesn't need xcdatamodeld files. But the very first setup line (`try CoreStoreDefaults.dataStack.addStorageAndWait()`) causes crash because it searches for a momd file. The error is this one: "Could not find "MyApp.momd" from the bundle "com.anthopak.MyApp". Other model files in bundle: 0 item(s) []". I've tried several variants of creating the DataStack, all leading to this error. I'm sure I'm missing something, probably obvious, but after several hours of searching I end up asking, because I can't fix it by myself...
adam added the question label 2025-12-29 15:30:56 +01:00
adam closed this issue 2025-12-29 15:30:56 +01:00
Author
Owner

@JohnEstropia commented on GitHub (Nov 25, 2022):

How are you setting up your store? See this section on the README for a sample on how to declare models without using momd files. Note that your models need to subclass CoreStoreObject rather than NSManagedObject

@JohnEstropia commented on GitHub (Nov 25, 2022): How are you setting up your store? See [this section on the README](https://github.com/JohnEstropia/CoreStore#declaring-model-versions) for a sample on how to declare models without using *momd* files. Note that your models need to subclass `CoreStoreObject` rather than `NSManagedObject`
Author
Owner

@AnthoPakPak commented on GitHub (Nov 25, 2022):

Thanks for your answer!

So yeah, actually I needed to define my DataStack using a CoreStoreSchema. It was indeed written in the docs, but since it was in the Migrations part, and that I was in the fresh new project (not caring about migrations yet), I've overlooked this part.

By reading the docs, it felt like try CoreStoreDefaults.dataStack.addStorageAndWait() was sufficient for the whole configuration.

Anyway, I'm now good with this and will now enjoy the rest of the lib ✌️

@AnthoPakPak commented on GitHub (Nov 25, 2022): Thanks for your answer! So yeah, actually I needed to define my `DataStack` using a `CoreStoreSchema`. It was indeed written in the docs, but since it was in the `Migrations` part, and that I was in the fresh new project (not caring about migrations yet), I've overlooked this part. By reading the docs, it felt like `try CoreStoreDefaults.dataStack.addStorageAndWait()` was sufficient for the whole configuration. Anyway, I'm now good with this and will now enjoy the rest of the lib ✌️
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/CoreStore#397