我收到错误“终止为NSException类型的未捕获异常”。这个问题有很多看法,但是并不能解决我的问题:libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)我已经能够找到该函数的错误位置:
func likeToLikeForAll(movieID: Int) {
let uid = Auth.auth().currentUser?.uid
Api.Like.REF_LIKES.child(uid!).child("100000").setValue(true)
Api.Like.REF_LIKES.child(uid!).observeSingleEvent(of: .value, with: { (snapshot) in
if let dictionary = snapshot.value as? [String: AnyObject] {
let array = Array(dictionary.keys)
for i in array {
let iInt = Int(i)!
if iInt != 100000 {
if movieID > iInt {
let movieIDString = String(movieID)
print("Bigger")
let nameOfLikeToLike = i + "." + movieIDString + "LL"
Api.LikeToLike.REF_LIKETOLIKE.child(nameOfLikeToLike).setValue(1)
}
else if movieID < iInt {
print("Smaller")
}
else if movieID == iInt {
print("Equal")
}
}
else {
print("Extra")
}
}
}
})
}
有人知道如何解决此错误吗?
答案 0 :(得分:1)
您的问题在于“ let nameOfLikeToLike = i +“。” + movieIDString +“ LL”“行。发送到Firebase实时数据库的字符串中。考虑将其替换为“:”