我当前的代码是用Swift 3编写的,我试图通过Xcode10.1更改Swift 4.2。 SQLite的更改版本崩溃并在旧代码上正常工作。
我正在尝试在Cocoa macOS应用程序中使用SQLite.swift和Swift检索表中的记录数。
let db = try Connection("\(pathh)/db.sqlite3")
let users = Table("users")
var count = try db.scalar(users.filter(userid == userid).count)
但是,执行此代码时,会引发以下异常:
unrecognized token: ":" (code: 1)
当我尝试使用var count = try db.scalar("SELECT COUNT(*) FROM users WHERE userid=?",userid) as! Int64
时,返回正确的结果。但是此使用情况返回错误
no such table tablename (code:1)
用于某些桌子。
任何帮助,我们将不胜感激。预先感谢!
在我的项目中,我需要更新Podfile中的以下内容:
pod'SQLCipher','〜> 4.2.0'pod'SQLite.swift / SQLChiper','〜> 0.12.0'吊舱更新后无法识别的令牌:“:”(代码:1)已解决。