0

CoreDataとSyncServicesフレームワークを使用してCocoaアプリケーションをプログラムしようとしています。

非常にうまく機能しますが、同期を開始しようとすると、次の例外が発生します。

>[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)\"}"
)

私のスキーマのプロパティリストは次のようになります。

<?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>

同期の開始を担当するコードは次のとおりです。

- (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;
}

グーグルは1つの結果しか生成しないので、非常に明白な問題である必要があります。これはほぼ5年前のものであり、実際には役に立ちません。

4

1 に答える 1

0

いくつかの点を確認してください。

  1. データ モデルをチェックし、タイプミスがないことを確認してください。
  2. .syncschema相対ファイルパスが正しいことを確認してください。
于 2010-07-13T04:38:18.073 に答える