firebase
データベースで更新を探すのにNSTimer
を使用しています。コードを私のviewDidLoad()
の中に入れました。ユーザーがデータベース内のファイルを受信した NSTimerを停止してView Controllerを閉じる(即時)
NSTimer.scheduledTimerWithTimeInterval(5.0, target: self, selector: #selector(DriversInterfaceViewController.CheckFormularChild), userInfo: nil, repeats: true)
は私が後藤他
ViewController
にユーザーをしたいです。問題は、古い
ViewController
がバックグラウンドで実行されているか、または
View Controller
を変更するとタイマーが停止しないことです。
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let nextViewController = storyBoard.instantiateViewControllerWithIdentifier("recievedMission") as! RecievedMissionViewController
self.navigationController!.pushViewController(nextViewController, animated: true)
どのように私は古いView Controller
を閉じるか、または私はNSTimer
programmatically
を阻止する方法を教えてくださいありがとう!そう、タイマーを無効にするだけで、あなたのタイマーのインスタンスを格納し、あなたが別のコントローラに移動しているとき
yourTimer.invalidate()