paulw11 / Seam3

Cloudkit based persistent store for Core Data
Other
209 stars 25 forks source link

Manually Access "sm_LocalStore_RecordID" From Managed Object #116

Closed Jerland2 closed 5 years ago

Jerland2 commented 5 years ago

I have an app that includes Seam 3 as a dependency, I am in need of directly accessing "sm_LocalStore_RecordID". Is there a way that I can directly access "sm_LocalStore_RecordID" from the managed object? I have tried directly calling value for key on the NSManagedObject but I get a fatal error that there is no key with that name? Any ideas?

  1. I have a NSManagedObject Subclass (On an app that has Seam 3 integrated)
  2. I want to access "sm_LocalStore_RecordID" somehow on that object

is this possible? if so, any direction?

paulw11 commented 5 years ago

You can't do that (and you shouldn't need to).

There are two persistent stores in Seam3 - The persistent store that is implemented by Seam3 and a regular SQLite persistent store that is used internally by Seam3 to cache the data from CloudKit locally. the sm_LocalStore_RecordID attribute is added to entities in this backing store. The backing store is not exposed to client applications

Jerland2 commented 5 years ago

This is unfortunate as I am trying to migrate an application away from Seam3 (Sorry, but I want to try to implement CloudKit myself, nothing bad towards the library). So it seems the only way to migrate away from Seam3 is to:

  1. Reset the backing store
  2. Refetch using my custom solution and clean the data Into my new format on refetch
  3. In a future update to the app I can then remove the Seam3 dependency

Perhaps when you get time you could implement a way to do this so that we can migrate the local Unique id that seam3 creates

paulw11 commented 5 years ago

You will need to write custom code to do what you want. You could write code to access the Seam3 backing store directly if you want