How to replace CoreData + CloudKit to only CoreData

89 Views Asked by At

My app's database uses CoreData + CloudKit, but I want to remove CloudKit and use only local CoreData.

I run the app after replacing NSPersistentCloudKitContainer to NSPersistentContainer, but failed to load persistant stores.

How to result this problem ?

 lazy var persistentContainer: NSPersistentContainer = {
        let container = NSPersistentContainer(name: name)
        container.loadPersistentStores { _, error in
            if let error = error {
                fatalError("Unable to load persistent stores: \(error)")
            }
       }
       return container
    }()
Error Domain=NSCocoaErrorDomain Code=134110 "永続ストアの移行中にエラーが起きました。" 
UserInfo={
  sourceURL=file:///Users/junya/Library/Developer/CoreSimulator/Devices/14670F13-60FF-4F9E-A714-0A8AB2329C2D/data/Containers/Data/Application/CD56521D-D435-4938-AE7A-AD5F7D6FF44C/Library/Application%20Support/MyAppModel.sqlite, 
  reason=Cannot migrate store in-place: near "null": syntax error,
  destinationURL=file:///Users/junya/Library/Developer/CoreSimulator/Devices/14670F13-60FF-4F9E-A714-0A8AB2329C2D/data/Containers/Data/Application/CD56521D-D435-4938-AE7A-AD5F7D6FF44C/Library/Application%20Support/MyAppModel.sqlite, 
  NSUnderlyingError=0x600003c31b90 {
   Error Domain=NSCocoaErrorDomain Code=134110 "永続ストアの移行中にエラーが起きました。" 
  UserInfo={
   reason=near "null": syntax error, 
   NSSQLiteErrorDomain=1, 
   NSUnderlyingException=near "null": syntax error
   }
 }
}
0

There are 0 best solutions below