ios4 - How to get iPhone method called periodically when app in background, using NSTimer when in foreground -



ios4 - How to get iPhone method called periodically when app in background, using NSTimer when in foreground -

i using [nstimer scheduledtimerwithtimeinterval ...] works fine when application in foreground, when have in background doesn't appear working.

what supposed happen application calls web service on periodic basis, in emulator can watch print out communication.

i observing uiapplicationdidenterbackgroundnotification event can alter modes, seems need switch perhaps setting several scheduled notification calls, run problem when switch application calling service twice while, or need cancel notification calls.

in emulator not seeing going applicationdidenterbackground when bring programme foreground of concern, bigger question how should calling of method periodically whether in foreground or background.

in case makes difference using xcode 3 , 4.0 sdk.

i found after restarting computer application did go applicationdidenterbackground.

but, in order create webservice phone call had phone call synchronously when in background, calling asynchronously seemed silently fail. using asihttprequest (http://allseeing-i.com/asihttprequest/).

since nstimer doesn't work while in background went using nsthread , used task can set time how long should sleep. believe done on main thread, didn't seem problem since application in background.

in order of work had set location in info.plist, may end using more battery.

ios4 notifications xcode3.2

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -