I've an app which run in background, and I want to stop all location services 30 min after entering into background mode.
So in my background function, I do this :
// 1800 sec = 30 min * 60 sec.
NSDate *date30min = [[NSDate alloc] initWithTimeIntervalSinceNow:1800.0];
NSLog(@"Date30min : %@", date30min);
self.timer = [[NSTimer alloc] initWithFireDate:date30min interval:1 target:self selector:@selector(stopLocation) userInfo:nil repeats:NO];
And my stopLocation function is :
- (void)stopLocation
{
NSLog(@"[My APP] [PASS INTO stopLocation]");
[self.locationManager stopMonitoringSignificantLocationChanges];
[self.locationManager stopUpdatingLocation];
[self.locationManager stopUpdatingHeading];
}
But my timer never call the function, what's my error please ? (My function is correctly implement into my .h and .m file, I tested this out of the background function.
Please help..