How to make a periodic call to a method in objective c?

后端 未结 4 1094
后悔当初
后悔当初 2020-12-19 17:15

if the question is not explained clearly please excuse me. I\'m developing an iphone Client-Server app, i created all the classes, instances and ect. I can even send get and

4条回答
  •  自闭症患者
    2020-12-19 17:40

    What you want is the NSObject method -performSelector:withObject:afterDelay:.

    Click for docs.

    If you have the method that it calls call this on itself again, you'll have a looping, self-firing delayed poll method.

    I'd recommend checking a class variable to see if you really mean it each time, so you can turn it off from outside itself.

提交回复
热议问题