【发布时间】:2017-03-17 18:51:33
【问题描述】:
我在从 Swift 2 转换到 Swift 3 后立即使用了这段代码,然后出现了这个错误消息。任何帮助将不胜感激。我对 Swift 3 很陌生。
func checkIfCorrect (_ buttonPressed:Int) {
if buttonPressed == playlist[numberOfTaps] {
if numberOfTaps == playlist.count - 1 { // we have arrived at the last item of the playlist
let time = DispatchTime(uptimeNanoseconds: DispatchTime.now()) + Double(Int64(NSEC_PER_SEC)) / Double(NSEC_PER_SEC)
DispatchQueue.main.asyncAfter(deadline: time, execute: {
self.nextRound()
})
return
}
numberOfTaps += 1
}else{ // GAME OVER
resetGame()
}
}
【问题讨论】:
-
完整的错误是什么?哪一行导致错误?