I'm here because a didn't find any solutions for my issue :(
I'm doing an simple application in which i have to send (by socket) some informations to a server (like GPS l/L, accuracy, Battery level, etc).
The current code works fine when application is in foreground.
myTimer = [NSTimer scheduledTimerWithTimeInterval: 2.0 target:self
selector: @selector(sendPosToServer:) userInfo:nil repeats: YES];
myTimer2 = [NSTimer scheduledTimerWithTimeInterval: 3.0 target:self
selector: @selector(sendBatteryToServer:) userInfo:nil repeats: YES];
myTimer3 = [NSTimer scheduledTimerWithTimeInterval: 5.0 target:self
selector: @selector(sendResToServer:) userInfo:nil repeats: YES];
myTimer4 = [NSTimer scheduledTimerWithTimeInterval: 5.0 target:self
selector: @selector(sendQResToServer:) userInfo:nil repeats: YES];
myTimer5 = [NSTimer scheduledTimerWithTimeInterval: 3.0 target:self
selector: @selector(sendPrecisionToServer:) userInfo:nil repeats: YES];
All thoses methods are called.
But when application enter in background, all timer are invalidate... I've read that iOS automatically stop timers..
I'm looking for a way to call methods and send datas when application is in background..
I need your help :)
Thanks to everyone !!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…