ABPerson in Core Data
I'm trying to figure out to store a reference to a开发者_运维百科n ABPerson in a Core Data store on an iPhone app. Ultimately, I'd like to be able to sync with a Mac version of the app (I'm assuming ABRecordIDs wouldn't be the same for the iPhone and the Mac). I was thinking of storing the record ID, name, and email and checking against those--is there a better way?
It kind of sounds like you're attempting to out-guess or re-do the syncing functionality Apple's already implemented. Can you describe exactly what you mean by "sync with a Mac version of the app"?
If you're asking for a better way to store the information about an ABPerson
to make it easy to recover the next app launch, there is a property in ABPerson
, kABUIDProperty
, which will give you a unique identifier for the record that is guaranteed not to change. I used something similar with an app that uses the Media Player Framework to identify exact songs between launches.
You can use kABPersonCreationDateProperty instead of kABUIDProperty, which is available in iOS.
精彩评论