Question

I found that to create an alarm app on iphone one should use Local Notifications.

However, this only starts to play a sound at a given time.

I did not find a way to start another app or to start specific code, that should happen a a specific time.

Is there a way to do this? If available, please also refer to a sample app.

Thanks very much...

Was it helpful?

Solution

It's easy. Just use NSTimer. Check the doco.

[NSTimer scheduledTimerWithTimeInterval:15.00
    target:self selector:@selector(yourRoutine) userInfo:nil repeats:NO]

OTHER TIPS

I don't think NSTimer actually fully answers the OPs question? My assumption was that he was asking how to start an app or run a bit of code when his app is not currently running. An NSTimer will only work if your app is already currently running. As far as I'm aware you cannot use it to start an app.

I'm also struggling to find a solution to this to enable a periodic sync of an app with a backend web service. On Android you can use a SyncAdapter to start your app in the background, but cannot find a similar mechanism in iOS.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top