Retired Document
Important:
The information in this document is deprecated in Mac OS X v10.7; don't use it for new development. Instead use the iCloud extensions to the NSFileManager
class to share file-based data and use the NSUbiquitousKeyValueStore
class to share preferences. Use the Address Book framework to access shared contact data and use the Calendar Store framework to access shared calendar data.
Formatting Records
When pulling records from the sync engine, the client can change the format of property values without the sync engine interpreting the reformatting as changes to the values and mistakenly syncing the changes to other clients.
For example, a device that has limited capacity may truncate strings to save space—limit all strings to 12 characters or less—or reformat phone numbers to a preferred style. Records that are changed in this way are called formatted records. Typically, you do not want the sync engine to interpret format changes as changes to actual property values and push them to all other clients.
Therefore, if you change the format of a pulled record, you need to notify the sync engine when accepting the record as follows. First you create an NSDictionary containing the key-value pairs of the formatted properties and add the ISyncRecordEntityNameKey
key to specify the record’s entity name. Then you pass this dictionary as the formattedRecord argument to clientAcceptedChangesForRecordWithIdentifier:formattedRecord:newRecordIdentifier:
. Thereafter, the sync engine remembers the client’s formatted values and does not generate false changes during a slow sync.
NSDictionary *formattedRecord = |
[NSDictionary dictionaryWithObjectsAndKeys: |
entityName, ISyncRecordEntityNameKey, |
[myRecord valueForKey:@"title"], @"title", nil]; |
[session clientAcceptedChangesForRecordWithIdentifier:recordIdentifier |
formattedRecord:formattedRecord |
newRecordIdentifier:nil]; |
Copyright © 2004, 2011 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2011-07-06