Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in persistentStoreEnsemble: globalIdentifiersForManagedObjects: - uniqueIdentifier - entity is not KeyValueCoding compliant #289

Open
dgwilson opened this issue Jun 12, 2020 · 14 comments

Comments

@dgwilson
Copy link
Contributor

I have a macOS desktop app and an iOS app that I wish to sync the data between. They are apps that already existing their respective app stores. And I'm trying to switch to ensembles free.

In the macOS app I'm getting this crash (ensembles free was downloaded about the beginning of June 2020).
I think I've followed all of the instructions for integration... wouldn't surprise me if I missed something.

The crash will happen on first run, not on the second. Then crash on the 3rd (same crash point/error) and not on the forth.
Screenshot of the crash is below. Zombie objects is also enabled.

Screen Shot 2020-06-13 at 11 27 34 AM

Ultimately I'm not sure if I should load my existing data and migrate to a new store? I'm don't know what the correct approach is. First thing is to get past this crash though.

  • David
@drewmccormack
Copy link
Owner

It looks like you probably don’t have a uniqueIdentifier property on all of your entities. You need to have something that identifies objects globally. If you do, the Ensembles can do all the import etc.

So figure out if you already have such a property and return that in the delegate method. If not, see the model chapter of the book for strategies to introduce such a property in preexisting data.

Kind regards,
Drew

@dgwilson
Copy link
Contributor Author

dgwilson commented Jun 13, 2020 via email

@drewmccormack
Copy link
Owner

drewmccormack commented Jun 13, 2020 via email

@dgwilson
Copy link
Contributor Author

dgwilson commented Jun 13, 2020 via email

@drewmccormack
Copy link
Owner

To "turn off" sync, simply don't call the leech or merge methods. Ensembles does not sync for you automatically. It is up to you to say when you want to sync. If you never call either of those methods, you will never sync.

To remove the local cache of data and "detach" from the cloud, call the deleech method.

If you want to remove all data, call deleech first, and in the completion handler, call the class method +removeEnsemble... passing in the file system object.

Kind regards,
Drew

@dgwilson
Copy link
Contributor Author

dgwilson commented Jun 16, 2020 via email

@drewmccormack
Copy link
Owner

Ensembles doesn't use or need any of the Apple Core Data sync. (Which one were you using: the old one or the new one from last year?)

It could be that to stop using Apple's 'old' solution, you have to migrate your store. See this article, in particular under the heading (iCloud on/Off Switch).
https://www.objc.io/issues/10-syncing-data/icloud-core-data/

@dgwilson
Copy link
Contributor Author

dgwilson commented Jun 21, 2020 via email

@drewmccormack
Copy link
Owner

drewmccormack commented Jun 21, 2020 via email

@dgwilson
Copy link
Contributor Author

dgwilson commented Jun 23, 2020 via email

@dgwilson
Copy link
Contributor Author

dgwilson commented Aug 1, 2020

Hi Drew...

Good news things seem to be going well... still in development between macOS and iOS (actual iPad and occasional simulator session).

I did at one stage remove the iPad application and delete all the data (via the desktop application). The began with a fresh data import which also loaded UUID's as - [[NSUUID UUID] UUIDString] - for all rows.

Now I'm getting new rows occasionally inserted... They have a UUID and the rest of the data is blank...

How can I figure out where these are coming from and fix or prevent it?

  • David

@drewmccormack
Copy link
Owner

drewmccormack commented Aug 2, 2020 via email

@dgwilson
Copy link
Contributor Author

dgwilson commented Aug 3, 2020

Funny story... I did the coding for that last night for the macOS version... I'll see if I can get iOS done tonight - real life work has got in the way.

If I've interpreted the instructions right... deleech on both (or all) devices... with 10 minutes and then initiate the leech and merge process.

ohhh wait one... I haven't done this... "remove cloud data using the CDEPersistentStoreEnsemble class method removeEnsemble..." ... I'll add that.

Thank you again for the assistance.

  • David

@dgwilson
Copy link
Contributor Author

dgwilson commented Aug 4, 2020

Good news. In my testing last night between macOS and iPadOS everything worked as it should have.
Confirming I did the deleech, removal of cloud data and leech and merge as per doc with 10 minutes elapsed between actions.
Now with this new knowledge and experience I can review first time data migration/conversion and the user experience.

Thank you again for the support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants