I try to program a Cocoa application with Core Data and the Sync Services framework,
it works quite well, but once I try to start the sync, i get the following exception:
>[NOTE: this exception originated in the server.]
can't register schema at /Users/sdk/Documents/Knoma/build/Release/Knoma.app/Contents/Resources/KnomaSchema.syncschema: it contains references to the following undefined objects:
(
"<ISDDataClass 0x10056e1d0 [com.knoma]>{ bundleRef=<ISDFileReference 0x10051fb80 [A3F1469E-68CE-417D-AFEB-F277E0FCF6CC-46008-0000F268982A8435]]>{ path=\"/Users/sdk/Documents/Knoma/build/Release/Knoma.app/Contents/Resources/KnomaSchema.syncschema\"; mtime=2010-07-11 20:23:25 +0200; bundleId=\"(null)\"; bundleRelativePath=\"(null)\"; windowsBinRelativePath=\"(null)\"} uiHelperClassName=\"(null)\" imagePath=\"(null)\" category=\"(null)\"}"
)
My schema's property list looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ManagedObjectModels</key>
<array>
<string>../../../Knoma_DataModel.mom</string>
</array>
<key>DataClasses</key>
<array>
<dict>
<key>ImagePath</key>
<string>SyncDataClass.tiff</string>
<key>Name</key>
<string>com.mycompany.knoma</string>
</dict>
</array>
<key>Name</key>
<string>com.mycompany.knoma</string>
</dict>
</plist>
The code responsible for the start of the sync is the following:
- (IBAction)startSync:(id)sender {
ISyncClient * client = [self syncClient];
[[[self managedObjectContext]persistentStoreCoordinator]syncWithClient:client
inBackground:YES
handler:self
error:nil];
}
- (ISyncClient *)syncClient
{
NSString *clientIdentifier = [[NSBundle mainBundle] bundleIdentifier];
NSString *reason = @"Unknown Error";
ISyncClient *client;
@try {
client = [[ISyncManager sharedManager] clientWithIdentifier:clientIdentifier];
if (client == nil) {
if (![[ISyncManager sharedManager] registerSchemaWithBundlePath:[[NSBundle mainBundle]pathForResource:@"KnomaSchema" ofType:@"syncschema"]]) {
reason = @"Can't register sync schema";
} else {
client = [[ISyncManager sharedManager] registerClientWithIdentifier:clientIdentifier descriptionFilePath:[[NSBundle mainBundle] pathForResource:@"ClientDescription" ofType:@"plist"]];
[client setShouldSynchronize:YES withClientsOfType:ISyncClientTypeApplication];
[client setShouldSynchronize:YES withClientsOfType:ISyncClientTypeDevice];
[client setShouldSynchronize:YES withClientsOfType:ISyncClientTypeServer];
}
}
}
@catch (id exception) {
client = nil;
reason = [exception reason];
}
if (client == nil) {
NSRunAlertPanel(@"You can't sync.", [NSString stringWithFormat:@"Registration Failed: %@", reason], @"OK", nil, nil);
}
return client;
}
Has to be a quite obvious problem, as google only produces one result, which is almost five years old and not really helpful.