Thursday, June 27, 2024
HomeiOS Developmentios - Deadly error: 'strive!' expression unexpectedly raised an error: Sudden null...

ios – Deadly error: ‘strive!’ expression unexpectedly raised an error: Sudden null worth for column


I had beforehand created a sqlite database in my app utilizing fmdb and generated some information, and I’m updating the app and utilizing sqlite.swift as a substitute of fmdb, however now I’m having an issue with a key of kind blob within the database desk, which has worth, however once I learn it utilizing sqlite.swift, this system at all times crashes with the error message

SQLite/Question.swift:1235: Deadly error: 'strive!' expression unexpectedly raised an error: Sudden null worth for column

The crashed code I wrote

func fetchAllNotes() -> [Note] {
    guard let db = db else {
    print("Database connection isn't accessible.")
    return []
    }
                
    var notesArray = [Note]()
                
    do {
    for observe in strive db.put together(notes) {
    let observe = Notice(
        id: notehttps://stackoverflow.com/q/78675585,
        title: noteios - Deadly error: 'strive!' expression unexpectedly raised an error: Sudden null worth for column,
        content material: observe[content],
        isdraft: observe[isdraft],
        fontsize: observe[fontsize]
    )
    notesArray.append(observe)
        }
    } catch {
    print("Did not fetch notes: (error)")
    }
                
    return notesArray
}


struct Notice: Identifiable {
    let id: Int64
    let title: String
    let content material: Blob
    let isdraft: Int
    let fontsize: Int
    
    init(id: Int64 = 0, title: String, content material: Blob, isdraft: Int = 1, fontsize: Int = 16) {
    self.id = id
    self.title = title
    self.content material = content material
    self.isdraft = isdraft
    self.fontsize = fontsize
    }
}

Any concepts? Thanks.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments