게임을 할 때마다 이런 일이 발생하지 않으며 5 회 또는 10 회의 재생마다 한번씩 발생합니다. 게임이 끝나면, 나는 실행 루프에서 플레시 버드 (Flappy Bird)의 파이프와 같은 재생 영역에 애니메이션을 적용하는 데 사용하는 CADisplayLink를 제거합니다. 그러나 경우에 따라 해당 행에서 충돌합니다. 라인 옆이 있습니다실행 루프에서 CADisplayLink를 제거 할 때 게임이 충돌하는 경우가 있습니다.
Thread 1: EXC_BAD_ACCESS (code=1, address=0x10)
이것은 코드입니다 : 내가 처음 CADisplayLink 부분을 주석 경우, 그냥 어쨌든 두 번째에 충돌합니다
func endGame(r : String) {
UIView.animateWithDuration(0.4, delay: 0.2, options: .CurveLinear, animations: {
self.scoreLabel.alpha = 0
}, completion: {
(finished: Bool) in
self.scoreLabel.removeFromSuperview()
});
self.view.userInteractionEnabled = false
reason = r
println("Game Over!!!")
//Crashes on this line
blockUpdateDisplayLink.removeFromRunLoop(NSRunLoop.currentRunLoop(), forMode: NSRunLoopCommonModes)
shiftDisplayLink.removeFromRunLoop(NSRunLoop.currentRunLoop(), forMode: NSRunLoopCommonModes)
scoreTimer.invalidate()
UIView.animateWithDuration(0.0001, delay: 0.7, options: .CurveLinear, animations: {
}, completion: {
(finished: Bool) in
self.performSegueWithIdentifier("Game Over", sender: self)
});
}
. 상기와 같은 "스레드 1"오류가
:
이
는 스택 트레이스이다.무슨 일 이니?