I'm trying to keep my iOS app running forever in the background, (or location sampling and diagnostic about the location) and i found this code -
[self.locationManager stopUpdatingLocation];
self.timer = [NSTimer scheduledTimerWithTimeInterval:self.currentTimerTime target:self selector:@selector(checkLocation) userInfo:nil repeats:NO];
[[NSRunLoop currentRunLoop]addTimer:self.timer forMode:NSRunLoopCommonModes];
[[UIApplication sharedApplication]beginBackgroundTaskWithExpirationHandler:nil];
This is working great but i have a feeling that apple would not like that, is that the best practice?