我正在構建應用程序的原型,其中持久存儲通過AFP在「服務器」計算機(同一LAN)上使用SQLite。 但是,我無法連接到我的應用程序的2個不同實例的商店。將核心數據持久存儲(SQLite)設置爲NORMAL鎖定模式
我設置持久存儲協調SQLite的編譯設置(與鎖)是這樣的:試圖即當第一次連接到從第二個客戶端存儲(當
NSPersistentStoreCoordinator *coordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:mom];
NSMutableDictionary *pragmaOptions = [NSMutableDictionary dictionary];
[pragmaOptions setObject:@"NORMAL" forKey:@"locking_mode"];
NSDictionary *storeOptions = [NSDictionary dictionaryWithObject:pragmaOptions forKey:NSSQLitePragmasOption];
if (![coordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:url options:storeOptions error:&error]) {
[[NSApplication sharedApplication] presentError:error];
return nil;
}
和錯誤消息我得到一個已經成功連接)是:
ERROR: sqlite database is locked because it is in use by another host that holds a host-exclusive lock on .../TestDBApp.storedata; this host UID... cannot override the host-exclusive lock until the other host UID... releases its locks on .../.TestDBApp.storedata-conch
我做錯了什麼?
是否正在使用Core Data和SQLite從2個客戶端訪問相同的存儲?
這是Core Data和/或SQLite API中的錯誤嗎?