michaelarmstrong / SuperRecord

A small set of utilities to make working with CoreData and Swift a bit easier.
MIT License
366 stars 27 forks source link

Fixed random SQLite error code:522, 'not an error' #44

Closed PGLongo closed 9 years ago

PGLongo commented 9 years ago

I've fixed an error that can affect some Simulator (mine for example) running unit-test.

2015-10-21 17:10:24.579 xctest[703:8687] CoreData: error: (522) I/O error for database at /Users//Library/Developer/CoreSimulator/Devices/5E7487DC-2883-45F6-8CC1-FB90A2EB73C1/data/Documents/Pokemon.sqlite. SQLite error code:522, 'not an error' fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=522 "(null)" UserInfo={NSSQLiteErrorDomain=522, NSUnderlyingException=I/O error for database at /Users//Library/Developer/CoreSimulator/Devices/5E7487DC-2883-45F6-8CC1-FB90A2EB73C1/data/Documents/Pokemon.sqlite. SQLite error code:522, 'not an error', NSFilePath=/Users/*/Library/Developer/CoreSimulator/Devices/5E7487DC-2883-45F6-8CC1-FB90A2EB73C1/data/Documents/Pokemon.sqlite}: file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-700.0.59/src/swift/stdlib/public/core/ErrorType.swift, line 50

Running multiple tests the database seems to be corrupted, maybe caused by sqlite temporary files.

I've improved NSPersistentStore deletion in tearDown.

Thanks

michaelarmstrong commented 9 years ago

hopefully this will let unit tests stop failing on my build server :dancers:

PGLongo commented 9 years ago

Same error?

michaelarmstrong commented 9 years ago

mine was test manager service generic error (typical Xcode server error)... its integrating now... will let you know if it passes :D

michaelarmstrong commented 9 years ago

IT PASSED!

PGLongo commented 9 years ago

GOOD!