neutron
neutron

Reputation: 373

Best approach to implement background task while app is running

What is the best approach to implement a task in iOS which is doing his work in an other thread while the app is running?

I would like to implement a Thread that is checking every 10 minutes for updates while the app is running. Is there such a possibility to implement this? I think I cant implement a thread that has an endless loop because apple will reject the app, right?

Upvotes: 1

Views: 256

Answers (1)

Michael Dautermann
Michael Dautermann

Reputation: 89559

You definitely do not need a thread that idles endlessly but I can't imagine Apple rejecting your app for that reason: but it's simply not good app design.

I suspect what you really want to do is have a "NSTimer" task that runs every ten minutes.

There's also the possibility of sending a performSelector:withObject:afterDelay: message to an object and then having that fire off a separate thread to do the background work.

Upvotes: 1

Related Questions