Search code examples
objective-cioscllocationmanagercllocationmkmapview

CLLocationManager updates only on Simulator Not on Devices


Here we have to update the current location by using the location manager,and its correctly updating on simulator but its not updating on device only 4 or 5 times only repeated.why the location is not updated frequently kindly hep me to solve this problem

Here i used code is showed below

CLLocationManager *locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate = self;
    locationManager.distanceFilter = kCLDistanceFilterNone;
    locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
    [locationManager startUpdatingLocation];

Delegate Method:

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation: (CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{

    NSLog(@"newLocation: %@",newLocation);
}

This is the delegate method is calling four or five times.


Solution

  • Here i solved this problem using this delegate method

    - (void)locationManager:(CLLocationManager *)manager
         didUpdateLocations:(NSArray *)locations{
    }