我有以下代码
let bookId = dict["bookId"] as? String ?? ""
let date = dict["date"] as? String ?? ""
let xp = dict["xp"] as? Double ?? 0.0
if (bookId !== "summary") {
hasBooks[bookId] = true
numCompletedBooks += 1
totalXp += 10
if dateNumBooks[date] == nil {
dateNumBooks[date] = 1
} else {
dateNumBooks[date]! += 1
}
dateBooks[bookId] = date
} else {
streak = dict["streak"] as? Int ?? 0
}
在行Cannot convert value of type 'String' to expected argument type 'AnyObject?'
上出现以下错误if (bookId !== "summary") {
。
我在做什么错了?
答案 0 :(得分:1)