stephencelis / SQLite.swift

A type-safe, Swift-language layer over SQLite3.
MIT License
9.67k stars 1.56k forks source link

App Crashing at Connection's Prepare Method - AssertionFailure #938

Closed Jeba-Moses-Official closed 3 years ago

Jeba-Moses-Official commented 5 years ago

Crash happening at try connection.prepare(query) statement.

Maximum occurrence in background

OS : 100% iOS 12

Build Information

Carthage: "stephencelis/SQLite.swift" == 0.11.6

Xcode 10.2.1 Swift 4.2

Logs:

0 libswiftCore.dylib 0x109e921a4 specialized assertionFailure(:_:file:line:flags:) + 42360 1 libswiftCore.dylib 0x109ee7c48 swift_unexpectedError + 280 2 SQLite 0x108eccb5c $S6SQLite10ConnectionC7prepareys11AnySequenceVyAA3RowVGAA9QueryType_pKFs0D8IteratorVyAHGycfUAHSgycfU + 204 3 SQLite 0x108ed7cd0 $S6SQLite3RowVSgIego_ADIegr_TRTA + 24 4 libswiftCore.dylib 0x109e76320 _ClosureBasedIterator.next() + 93472 5 libswiftCore.dylib 0x109e764ac _IteratorBox.next() + 93868 6 libswiftCore.dylib 0x109d38050 AnyIterator.next() + 237412 7 libswiftCore.dylib 0x109e764ac _IteratorBox.next() + 93868 8 CrewForceRelease 0x100fcf0f0 specialized static SyncHelper.query(:tableName:limit:contextId:) ()

Jeba-Moses-Official commented 5 years ago

SQLITE CRASH

adramani90 commented 4 years ago

Did you get any solution for the above issue? Because i get the same error but still not got the solution. Please help me to get out of this. Thanks.

dbanik commented 4 years ago

I am seeing the same issue. Would be helpful to have a solution.

mickael-menu commented 4 years ago

You need to disable the file protection on the folder containing your database, because it gets encrypted when the device is locked.

try FileManager.default.setAttributes([.protectionKey: FileProtectionType.none], ofItemAtPath: folderPath)

More info here: https://github.com/groue/GRDB.swift/blob/master/README.md#data-protection