I (Basically) need to create a background timer on iOS 4 that will allow me to execute some code when a specific amount of time has passed. I have read that you can accomplish this using some [NSThread detachNewThreadSelector: but how does that work in practice? How can I ensure that the thread remains in the background also. Local notifications will NOT work for me, as I need to execute code, not notify the user.
toTarget:
withObject:];
Help would be appreciated!
You can use those call to execute a method (selector) of an object (toTarget) with some parameter (withObject) in a new thread (detachNewThred).
Now if you want to execute a delayed task may be the best approach is
performSelector: withObject: afterDelay:and the if you want to run the task on background call thedetachNewThreadSelector: toTarget: withObject: