ios - how to call a method by using nstimer in background state -


i want fetch service every 15 mins,so using nstimer.it working fine.but how call same service while app in background state using nstimer.nstimer not working in background state.please suggest me.

//when application move active inactive state.

- (void)applicationwillresignactive:(uiapplication *)application {     [self sendbackgroundlocationtoserver]; }   - (void) sendbackgroundlocationtoserver { uibackgroundtaskidentifier bgtask = uibackgroundtaskinvalid; bgtask = [[uiapplication sharedapplication]           beginbackgroundtaskwithexpirationhandler:^{               [[uiapplication sharedapplication] endbackgroundtask:bgtask];           }];   //start timer [self starttimer];  //close task if (bgtask != uibackgroundtaskinvalid) {     [[uiapplication sharedapplication] endbackgroundtask:bgtask]; } } 

Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -