您好,我正在開發一個應用程序,在我的應用程序中使用swift2我想跟蹤用戶成功登錄時的每5分鐘的位置現在我可以成功跟蹤用戶的位置現在我想跟蹤應用程序在後臺的時間,使用應用程序委託,但所有的功能和方法,我只寫在視圖控制器,所以我怎麼能調用視圖控制器的方法和功能,以應用程序委託。如何從視圖控制器調用所有方法和功能到應用程序委託?
代碼的viewController:
class ThirdViewController: UIViewController{
In view did load:
{
////// i created timer scheduled with time internal /////
}
////// Here am fetched current locations and performed some function for timer to execute //////
}
在我的appDelegate:
func applicationDidEnterBackground(application: UIApplication) {
if UIApplication.sharedApplication().applicationState != .Active{
//here i have to call that timer function execute how to do that????
}
我沒有使用過類似通知什麼....如何使用?什麼是 「notificationname」 你只要你的編碼,你解釋一下...抱歉@sahil – antonyraja
從這裏閱讀https://www.andrewcbancroft.com/2014/10/08/fundamentals-of-nsnotificationcenter-in-swift/ – Sahil
你有沒有試過這個? – Sahil