Skip to content

Instantly share code, notes, and snippets.

@thandang
Forked from eito/gist:7175555
Created December 11, 2013 08:11
Show Gist options
  • Save thandang/7906692 to your computer and use it in GitHub Desktop.
Save thandang/7906692 to your computer and use it in GitHub Desktop.
-(void)locationManager:(CLLocationManager *)manager didFinishDeferredUpdatesWithError:(NSError *)error {
NSLog(@"%s -- error: %@", __PRETTY_FUNCTION__, error);
_deferring = NO;
}
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
NSLog(@"%s -- %d locations", __PRETTY_FUNCTION__, locations.count);
[self.locationUpdates addObject:locations];
[self.tableView reloadData];
}
-(void)locationManagerDidPauseLocationUpdates:(CLLocationManager *)manager {
NSLog(@"%s", __PRETTY_FUNCTION__);
}
-(void)locationManagerDidResumeLocationUpdates:(CLLocationManager *)manager {
NSLog(@"%s", __PRETTY_FUNCTION__);
}
-(BOOL)locationManagerShouldDisplayHeadingCalibration:(CLLocationManager *)manager {
return YES;
}
- (void)enterringBackground {
NSLog(@"%s", __PRETTY_FUNCTION__);
if (![CLLocationManager deferredLocationUpdatesAvailable]) {
NSLog(@"NO DEFERRED LOCATION AVAILABLE");
return;
}
if (!_deferring) {
NSLog(@"Deferred location available");
[self.locationManager allowDeferredLocationUpdatesUntilTraveled:CLLocationDistanceMax timeout:CLTimeIntervalMax];
_deferring = YES;
}
}
- (void)enterringForeground {
NSLog(@"%s", __PRETTY_FUNCTION__);
[self.tableView reloadData];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment