< Previous PageNext Page > Hide TOC

Registering Schemas

Typically, schemas are owned by one client and possibly used by multiple clients, although this approach is not enforced. Usually a schema owner registers the schema with the sync manager. Otherwise, multiple clients must coordinate registering a shared schema. It is highly recommended that you register the schema periodically even if it does not change—for example, register the schema each time your application launches. However, if a schema changes, update it with caution because changing a schema may cause records to be deleted and cause some clients to slow sync.

You register schemas with the shared ISyncManager using the registerSchemaWithBundlePath: method. Typically, a schema is stored in a bundle along with other related files such as images. The following code fragment gets the schema bundle and registers the schema property list:

[[ISyncManager sharedManager] registerSchemaWithBundlePath:@"/Library/SyncServices/Schemas/SyncExamples.syncschema"];

You can register a schema multiple times. The sync engine compares the old and new schema and updates the schema only if it changed. If it changed, the new schema replaces the old one, records in the truth database may be deleted, and clients that use the schema may slow sync.

You can also unregister a schema, but doing so removes all records associated with the entities defined in that schema. You unregister a schema using the unregisterSchemaWithName: method.

Typically, you do not need to register Apple application schemas. See Apple Applications Schema Reference for more information on Apple application schemas.

Read “Creating a Sync Schema” for more information on designing your own schemas.



< Previous PageNext Page > Hide TOC


© 2004, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-10-31)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.