                     }
                     self.sendLocalNotif("\(selectedCity()):解析得到新数据，刷新手表", badge: tmpAQI)
                     completionHandler?(.NewData)
-                    if let unwrappedID = self.bgTaskID {
-                        self.bgTaskID = nil
-                        UIApplication.sharedApplication().endBackgroundTask(unwrappedID)
-                    }
+                    self.properlyEndBgTaskIfThereIsOne()
                     return
                 }
                 if tmpAQI < 1 || tmpConcentration < 1 {

    private var time: String? = "Invalid"
    var wcSession: WCSession?
    private var session: NSURLSession?
    private var bgTaskID: UIBackgroundTaskIdentifier? = nil
    
    func registerBackgroundVOIPCallback() {
        let ret = UIApplication.sharedApplication().setKeepAliveTimeout(600) { () -> Void in
            NSLog("voip called...")
            self.bgTaskID = UIApplication.sharedApplication().beginBackgroundTaskWithExpirationHandler({ () -> Void in
                self.fetchNewData()
            })

            }
            self.isLoadingData = false
            completionHandler?(.NoData)
            self.properlyEndBgTaskIfThereIsOne()
        }
    }
    
