iphone - Stop setKeepAliveTimeout handler from being called after application came foreground? -
for voip application sending ping packet server every 10 minutes using setkeepalivetimeout, works fine, i'm not sure how stop handler being called once application came foreground.
eg: here how set timeout
[[uiapplication sharedapplication] setkeepalivetimeout:600 handler:^{ [self backgroundhandler]; }]; background handler:
- (void)backgroundhandler { printf("10 minute time elapsed\n"); // action... } above function being called after application came foreground, have read in apple documentation set handler nil stop it. have tried below in applicationwillenterforeground
[uiapplication sharedapplication] setkeepalivetimeout:600 handler:nil]; still i'm getting call every 10 mins. how handle this, need use flag only.
any appreciated.
you have invoke clearkeepalivetimeout stop timer. setkeepalivetimeout: designed keep voip connection on , that's why it's periodically called.
Comments
Post a Comment