Can two NSPsistentStoreCoordinator use the same database?

I am considering the possibility of using two persistent store coordinator, PSC1will only read . the sqlite DB, PSC2will read and write DB . Sometimes it PSC1will reload content from DB.

Do you think this is possible?

Do you think that two PSCs can read / write databases in an atomic way and not cause any damage?

Has PSC set any lock on the database to access from another PSC?

+4
source share
1 answer

You can have two different instances NSPersistentStoreCoordinatorto access the same files. In fact, many years ago this was the recommended approach.

. NSPersistentStoreCoordinator , , NSPersistentStoreCoordinator . NSPersistentStoreCoordinator NSManagedObjectContext , . NSPersistentStoreCoordinator , - . , NSPersistentStoreCoordinator A NSPersistentStore, . NSPersistentStoreCoordinator B , , A- . Core Data fufil A, .

, PSC / , - ?

NSSQLiteStoreType. .

PSC - , PSC?

NSPersistentStore ( ). , , , NSPersistentStore .

, , . .

+5

All Articles