scheduling task in iphone

2019-08-18 01:44发布

问题:

I am developing an iphone app, there's a section in it where user can declare his task and its occurence in time. I.e. recursive task. The task will only show an alert box and nothing else when its due time. Its a kind of reminder, rather than a real task scheduler.

What's the best way or technology to achieve that with objective-c, particularly on iphone. I was also thinking, if not too time consuming to implement, about some kind of integration with iphone calendar. Would it be nice to have the app create its own calendar.

thanks

回答1:

I think this is one of the good methods to use. You can define the object and its selector so that after a period of time, the timer will call something like [targer performSelector:aSelector];

+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)seconds target:(id)target selector:(SEL)aSelector userInfo:(id)userInfo repeats:(BOOL)repeats

More Details here



回答2:

You should look into using a Push Notification

More info: http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html