NSTimer Reliable Alternatives

前端 未结 2 439
感情败类
感情败类 2020-12-09 20:30

I have an application that is supposed to log certain things every 1 second and I\'m currently using NSTimer, but if my application transitions screens (or almo

2条回答
  •  甜味超标
    2020-12-09 21:06

    You could:

    • Put the NSTimer in a different thread (it may not be affected by the UI that way)
    • Decrease the interval (say 0.1 second) and, in your logging function, check if it is the "right" time to log what you want.

提交回复
热议问题