magicalpanda / MagicalRecord

Super Awesome Easy Fetching for Core Data!
Other
10.8k stars 1.79k forks source link

Saving issue - NSSQLiteErrorDomain error 13 #1337

Open pmiotto opened 5 years ago

pmiotto commented 5 years ago

I have an app currently live with high volume of daily users (100k +). Every time the app opens it tries to save a small json from an endpoint to coredata. It works 99.9% of the times but sometimes I get the following errors: • The operation couldn’t be completed. (NSSQLiteErrorDomain error 13.) • The operation couldn’t be completed. (Cocoa error 13.) • The file “” couldn’t be opened.

from this block of code:

MagicalRecord.save({ context in
            User.mr_truncateAll(in: context)
            users.forEach({ user in
                if let item = Prize.mr_createEntity(in: context) {
                    item.name = user.name
                }
            })
        }, completion: { (_: Bool, error: Error?) in
            Log(error.localizedDescription)
        })

Any insights would be appreciated.

messi commented 3 years ago

In case someone is googling that error and is finding this issue: most likely related to having not sufficient disk space left on the device.