您好我在Swift中遇到GRDBCipher问题。当尝试使用记录时,它会给我一个错误类型"结构"没有成员插入。我也得到更新错误。
struct PointOfInterest {
var id: Int64?
var title: String
var isFavorite: Bool
var coordinate: CLLocationCoordinate2D
}
// snip: turn PointOfInterest into a "record" by adopting the protocols that
// provide fetching and persistence methods.
do{
try dbQueue.inDatabase { db in
var berlin = PointOfInterest(
id: nil,
title: "Berlin",
isFavorite: false,
coordinate: CLLocationCoordinate2D(latitude: 52.52437, longitude: 13.41053))
try berlin.insert(db) //error here
berlin.id // some value
berlin.isFavorite = true
try berlin.update(db) //error here
// Fetch [PointOfInterest] from SQL
let pois = try PointOfInterest.fetchAll(db, "SELECT * FROM pointOfInterests")// error on fectchAll
}
} catch {
print("broke")
}