Skip to content
This repository has been archived by the owner on Dec 17, 2018. It is now read-only.

Initial properties not available when sync failed #31

Open
Ezor opened this issue Mar 30, 2018 · 6 comments
Open

Initial properties not available when sync failed #31

Ezor opened this issue Mar 30, 2018 · 6 comments

Comments

@Ezor
Copy link

Ezor commented Mar 30, 2018

Hi,

Here is the failing scenario :

  • Create an NSManagedObject with the following properties : firstname = 'John', lastname = 'Doe'
  • Save context
  • CloudCore try to sync this new Object but if fails for whatever reason (iCloud not available, limit exceeded...). So we don't have the corresponding CKRecord in CloudKit.
  • Later, we update the same NSManagedObject : firstname = 'Jane', lastname = 'Doe'
  • CloudCore create a CKRecord with only updated properties : firstname = 'Jane'

So on CloudKit, we will never have the property set during NSManagedObject creation, here lastname = 'Doe'.

I'm not sure how it could be fixed apart by always updating all properties.

@Sorix Sorix added the bug label Apr 6, 2018
@Sorix
Copy link
Owner

Sorix commented Apr 6, 2018

That's really a big problem, I need to think how to handle it. It can be handled automatically or I need to send "failed" syncs to some delegate, so your application will decided what to do (try to re-sync and discard changes).

I will place it to my to-do list, thank you.

@Ezor
Copy link
Author

Ezor commented Apr 6, 2018

Well I think iCloud synchronization must not affect the way we add, update or delete data.
My idea is CloudCore should detect that we need to upload all properties again maybe using a property on the ManagedObject (like lastSyncFailed = 1).

On my fork, to fix this temporary, I updated the code to upload all properties each time.

@pocreations
Copy link

pocreations commented Apr 10, 2018 via email

@Ezor
Copy link
Author

Ezor commented Apr 10, 2018

Hi,

Ezor@01b680a

@pocreations
Copy link

pocreations commented Apr 10, 2018 via email

@rockylive
Copy link

Hi @Ezor

I also had the problem where some properties getting nil (Adding cloudcore to existing db). I tried your fix and it's ok with newly created DB or entries. but if you have existing DB, and enabling cloud core with your fix will crash the app in launch.

screen shot 2018-10-16 at 4 05 45 pm
This is the place it get stopped

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

No branches or pull requests

4 participants