質問

Is it possible to create a relationship without specifying a specific custom NSManagedObject as the destination entity?

E.g., I would like to create an NSManagedObject subclass called SyncInfo that will contain attributes regarding syncing and sync options with Parse or some other third party cloud-based database. SyncInfo would possess a relationship called managedObject that I could then point towards any NSManagedObject that I wish to have synced with Parse. The idea is that I could fetch SyncInfo objects from Core Data rather than the data objects themselves when determining which objects need to be synced with Parse. The relationship between a SyncInfo object and an NSManagedObject would be 1:1 always.

This is my first time attempting to sync data on my iPhone app with a third party server so I apologize if my best attempt at architecturing this is incorrect. To teach myself I followed the Ray Wenderlich tutorial and got that working and am now attempting to build a slightly more robust version for my app.

役に立ちましたか?

解決

Just create a parent entity that has the SyncInfo relationship and base all your other entities on that one.

Look at "Entity Inheritance" here.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top