我正在构建应用程序的原型,其中持久存储通过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中的错误吗?