tags:

views:

56

answers:

1

Im currently working on a timer app similar to apple's default "Clock" utility

but when the user quits, NSTimers no longer seem to have any effect

would I have to use push notifications to alert the user the timer has ended, or is there some other way I can run an action on a timer after the application quits?

thanks in advance

+1  A: 

When you app quits, it has ended and there is no way to run code after that point.

You could do something with notifications, but that would be a hack and not very practical. Notifications might not appear. Or have delays. Also, no code is run when receiving a notification. Only when the user decides to open your app after receiving one.

St3fan
but then how does the clock utility play alarms even after it quits?there must be some "legal" way of doing this...
pop850
There are few exceptions.... Few of Apple's own applications have a mechanism to work in the background.
Deepak
No there is no legal way.
St3fan
As noted Alarm is a system app - a number of system apps do things in the background (Mail for instance can still fetch new mail). The best you can do is issue a notification, which can have a sound attached... if you are doing an alarm, you could issue three or four in short order until the app is launched which would contact your server to stop sending the notification. In practice, there is virtually no delay in sending a notification and the user receiving it.
Kendall Helmstetter Gelner