قالب وردپرس درنا توس
Home / IOS Development / IOS – Why the timer invokes its block so quickly sometimes

IOS – Why the timer invokes its block so quickly sometimes



I make a timer and invoke block every 5 seconds. Then I apply to go into the background and post the foreground after a while.

  la _ = Timer.scheduledTimer (withTimeInterval: 5.0, repeats: true) {(hours) in
print("--------")
}

When I enter the foreground, the interval for first printing and second printing may be less than a second sometimes. Is the time interval invalid in this case?


Source link