diff --git a/tns-core-modules/timer/timer.ios.ts b/tns-core-modules/timer/timer.ios.ts index 953e6de31..33c12cd92 100644 --- a/tns-core-modules/timer/timer.ios.ts +++ b/tns-core-modules/timer/timer.ios.ts @@ -1,4 +1,6 @@ -//iOS specific timer functions implementation. +import * as utils from "utils/utils"; + +//iOS specific timer functions implementation. var timeoutCallbacks = new Map>(); var timerId = 0; @@ -52,6 +54,9 @@ function createTimerAndGetId(callback: Function, milliseconds: number, shouldRep let timerTarget = TimerTargetImpl.initWithCallback(callback, id, shouldRepeat); let timer = NSTimer.scheduledTimerWithTimeIntervalTargetSelectorUserInfoRepeats(milliseconds / 1000, timerTarget, "tick", null, shouldRepeat); + // https://github.com/NativeScript/NativeScript/issues/2116 + utils.ios.getter(NSRunLoop, NSRunLoop.currentRunLoop).addTimerForMode(timer, NSRunLoopCommonModes); + let pair: KeyValuePair = { k: timer, v: timerTarget }; timeoutCallbacks.set(id, pair);