Search code examples
core-datansmanagedobjecticloudicloud-api

Core Data + iCloud: Find NSManagedObject across devices


How do I find the same NSManagedObject object across 2 devices? I tried to save the [object objectID.URIRepresentation.absoluteString] but it doesn't seem to be consistent across stores ... when I load up [managedObjectContext objectWithURI] with the same URI on another device, it points to a different object.

I'm guessing the problem is that the 2 devices point to a different store on each device. So what would be the best way to make it consistent across both devices?


Solution

  • It seems that the 2 devices have two different stores, so the URIs won't match across devices. Creating your own GUID attribute, and fetching based on that GUID, is the only way to go.