从SQLitt到Swift 4.2的Swift 3.0到Swift 4.2的转换错误

问题描述 投票:0回答:1

我当前的代码是用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)

用于某些桌子。

任何帮助,我们将不胜感激。预先感谢!

ios xcode swift4.2 sqlite.swift xcode11.4
1个回答
1
投票

在我的项目中,我需要更新Podfile中的以下内容:

pod'SQLCipher','〜> 4.2.0'pod'SQLite.swift / SQLChiper','〜> 0.12.0'吊舱更新后无法识别的令牌:“:”(代码:1)已解决。

© www.soinside.com 2019 - 2024. All rights reserved.