How to call function in every “X” minute?

自作多情 提交于 2019-12-01 09:56:39

问题


I was trying to make a sample iphone application to update current location. I have a function that logs the current location, "logCurrentLocation", but I have no idea how to call this function automatically in every X minutes( or seconds).

Please advise me which method I need to look at in the apple documentation.

Thank you for your help.

sung.


回答1:


Check out the documentation for NSTimer. It allows you to schedule a timer which will call a function (defined by a "Target" object and a "Selector" you want to call). You can change the interval at which the timer fires, and it should do the trick!



来源:https://stackoverflow.com/questions/1053585/how-to-call-function-in-every-x-minute

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!