Is there a way to initialize an NSTimer
in swift in the AppDelegate
. I'm trying to start a timer once a user exit's a beacon monitoring region like so.
func locationManager(manager: CLLocationManager!,
didExitRegion region: CLRegion!) {
manager.stopRangingBeaconsInRegion(region as! CLBeaconRegion)
manager.stopUpdatingLocation()
NSLog("You exited the region")
sendLocalNotificationWithMessage("You exited the region", playSound: true)
}
var timer = NSTimer.scheduledTimerWithTimeInterval(0.4, target: self, selector: Selector("yourFunction"), userInfo: nil, repeats: true)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.