Seam icon indicating copy to clipboard operation
Seam copied to clipboard

SeamStoreType undeclared identifier

Open koenvanderdrift opened this issue 9 years ago • 12 comments

I have added Seam to my ObjectiveC project using CocoaPods, and successfully declared a property for the store:

@property (nonatomic, readonly) SMStore *seamStore;

I then use the following code to add it to my NSPersistentStoreCoordinator:

_store = [_coordinator addPersistentStoreWithType: SeamStoreType configuration: nil URL: storeURL options: options error: &error];

Which gives me an undeclared identifier error for SeamStoreType.

What do I need to do for my code to recognize SeamStoreType?

koenvanderdrift avatar Sep 12 '15 09:09 koenvanderdrift

You can also try SMStore.type instead of SeamStoreType.

nofelmahmood avatar Sep 12 '15 09:09 nofelmahmood

Thanks that works.

But I now get the following error when my app starts:

2015-09-12 05:31:09.413 MyApp[1370:294516] CoreData: error: -addPersistentStoreWithType:Seam.SMStore configuration:(null) URL:file:///var/mobile/Containers/Data/Application/840EABA8-B794-4D9B-8ED5-DC9BA079B8E5/Documents/Stores/MyApp.sqlite options:{ NSInferMappingModelAutomaticallyOption = 1; NSMigratePersistentStoresAutomaticallyOption = 1; NSSQLitePragmasOption = { "journal_mode" = DELETE; }; } ... returned error Error Domain=Seam.SMStoreError Code=2 "The operation couldn’t be completed. (Seam.SMStoreError error 2.)" with userInfo dictionary { }

And

reason = "The model used to open the store is incompatible with the one used to create the store";

Any idea what could be causing this ?

(Sorry, I'm new to Swift).

koenvanderdrift avatar Sep 12 '15 09:09 koenvanderdrift

Delete the app from the simulator/device and rebuild/reinstall it again.

nofelmahmood avatar Sep 12 '15 09:09 nofelmahmood

That gives the same error. ~~Seems to be a migration error caused by adding a persistentStore (my model didn't change), so I don't know if it is a Seam issue.~~

koenvanderdrift avatar Sep 12 '15 09:09 koenvanderdrift

Let me investigate this :)

nofelmahmood avatar Sep 12 '15 11:09 nofelmahmood

Just to clarify, I'm trying to add CloudKit to an existing app that already uses CoreData.

koenvanderdrift avatar Sep 13 '15 18:09 koenvanderdrift

I'm also getting this problem in my project. CoreData is already in use, and no changes to the model have been made. Hopefully this can be fixed! :smile:

PenguinGeorge avatar Sep 13 '15 19:09 PenguinGeorge

I implemented a NSIncrementalStore for CouchDB and had similar problems. It's about NSStoreUUIDKey. I think the store needs to handle/store it and not take it from the underlying persistent store.

I can look up more details tomorrow, if you like.

Am 13.09.2015 um 21:17 schrieb George Jones [email protected]:

I'm also getting this problem in my project. CoreData is already in use, and no changes to the model have been made. Hopefully this can be fixed!

— Reply to this email directly or view it on GitHub.

chbeer avatar Sep 13 '15 19:09 chbeer

One cause could be the modification of the model by SMStoreChangeSetHandler.modelForLocalStore

chbeer avatar Sep 16 '15 12:09 chbeer

I am really really sorry @chbeer @koenvanderdrift @PenguinGeorge for not being able to do something about it at the moment. But I did check and I didn't face this particular error, all was working fine for me. But still I am committed to something really important for the next few days. Once I am done with it my next priority would be looking into it in more depth. @chbeer Seam modifies the model to add some entities and attributes which are used to keep track of local changes. It then uses this model to create a SQLiteStoreType. This may help :)

nofelmahmood avatar Sep 16 '15 17:09 nofelmahmood

Not a problem for me at the moment, as I'm adding it in to an update which is a few weeks away yet. :) Looking forward to a fix though.

PenguinGeorge avatar Sep 16 '15 17:09 PenguinGeorge

@nofelmahmood Have you been able to make any progress with this issue?

koenvanderdrift avatar Oct 30 '15 19:10 koenvanderdrift