let totalPrice: Double = price * value
var money: Double = 0
for totalPrice in dataArray {
    money = money + totalPrice
}


无法分配二进制运算符“ +”

最佳答案

如何声明“ dataArray”?

是[AnyObject]还是[Double]

如果是前者,则需要使用:

guard let price = totalPrice as? Double else { continue }
money = money + totalPrice

10-08 03:12