Optimizing CLLocationManager/CoreLocation to retrieve data points faster on the iPhone

I’ve had lots of issues with CLLocationManager on the iPhone also. From different Apps, and trial and error this is what I’ve figured out; 1) Use a singleton class for the locationManager, ONLY ONE Instance, follow the examples in: Apple’s LocateMe example Tweetero : http://tweetero.googlecode.com/svn/trunk I’m thinking you can only have one location manager running, … Read more

Region Monitoring Glitch on iOS 7 – Multiple Notifications at the same time

I have found a fix for this strange bug. We have tested for over 1 week and so far we haven’t see the same bug again. Here is the solution:- -(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region{ NSLog(@”didEnterRegion”); CLLocation * lastLocation = [manager location]; BOOL doesItContainMyPoint; if(lastLocation==nil) doesItContainMyPoint = NO; else{ CLLocationCoordinate2D theLocationCoordinate = lastLocation.coordinate; CLCircularRegion * theRegion … Read more

Location access – App is not asking for user permission to access location – iOS 11

I have gone through the Apple documentation and found the solution for this question. Apple has changed few guidelines to get user location. Here is the Video Link: Apple- What’s New in Location Technologies Full code for location access in Swift & Objective-C both Solution: Now we need to add three Authentication Key into Plist: … Read more

locationManager:didEnterRegion not called when a beacon is detected

Check if your methods are implemented in the following way. In viewDidLoad, start moniotoring at the end self.beaconRegion.notifyOnEntry=YES; self.beaconRegion.notifyOnExit=YES; self.beaconRegion.notifyEntryStateOnDisplay=YES; [self.locationManager startMonitoringForRegion:self.beaconRegion]; after monitoring start, request state for your defined region – (void) locationManager:(CLLocationManager *)manager didStartMonitoringForRegion:(CLRegion *)region { [self.locationManager requestStateForRegion:self.beaconRegion]; } after state is determined, start ranging beacons -(void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion *)region { if … Read more

Calculate Total Traveled Distance iOS Swift

update: Xcode 8.3.2 • Swift 3.1 The problem there is because you are always getting the same location over and over again. Try like this: import UIKit import MapKit class ViewController: UIViewController, CLLocationManagerDelegate { @IBOutlet weak var mapView: MKMapView! let locationManager = CLLocationManager() var startLocation: CLLocation! var lastLocation: CLLocation! var startDate: Date! var traveledDistance: Double … Read more