2015-08-11 4 views
0

импорт UIKittimer.invalidate() вызывает сбой, говоря thread1: breakpoint1.1

class ViewController: UIViewController 
{ 


    @IBOutlet weak var secondsLabel: UILabel! 
    @IBOutlet weak var milliSecondsLabel: UILabel! 

    var milliTimer=NSTimer() 

    var count:Int=1 
    var milliCount:Int=1 

    @IBAction func StartPauseTimer(sender: AnyObject) 
    { 
     milliTimer=NSTimer.scheduledTimerWithTimeInterval(1/100, target: self, selector: Selector("milliIncTimer"), userInfo: nil, repeats: true) 

    } 
    @IBAction func StopTimer(sender: AnyObject) 
    { 
     milliTimer.invalidate() 
     count = 1 ///this the place i get the error 
        //on pressing stop button, 
        //it says thread1:breakpoint1.1 
     milliCount = 1 

     secondsLabel.text = "0" 
     milliSecondsLabel.text = " " 
    } 
    override func viewDidLoad() 
    { 
     super.viewDidLoad() 

    } 
    func milliIncTimer() 
    { 
     if milliCount==101 
     { 
      milliCount = 1 
      secondsLabel.text = "\(count++)" 
     } 
     milliSecondsLabel.text = "\(milliCount++)" 
    } 

    override func didReceiveMemoryWarning() { 
     super.didReceiveMemoryWarning() 
     // Dispose of any resources that can be recreated. 
    } 


} 

журналы говорят, что это

сделать символическую точку останова на UIViewAlertForUnsatisfiableConstraints, чтобы поймать это в отладчике. Методы в категории UIConstraintBasedLayoutDebugging в списке UIView, также могут быть полезны. (lldb)

ответ

0

Возможно, вы случайно поставили точку останова.

В коде на линии:

count = 1 

Теперь на этой линии посмотрите налево и вы увидите синюю стрелку.

Вы можете удалить стрелку, перетащив стрелку вправо и отпустите.

Надеюсь, это помогло вам!

Смежные вопросы