我是Swift的新手,这个错误是什么:
let lvt=self?.lastVibrationTime
let delta=self!.deltaTime
let sens=self!.shakeSensitivity
let time:Double = CACurrentMediaTime()
//error is on `lvt` and says : Error:(37, 27) value of optional type 'Double?' not unwrapped; did you mean to use '!' or '?'?
if time - lvt > delta && data.userAcceleration.x < sens {
println("firmly shaken!")
self?.vibrateMe()
}
lvt
更改为lvt!
。 - ztan