-2

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.

dineshprasanna
  • 1,284
  • 4
  • 20
  • 37
  • 1
    How much frequently do you except the location to be updated? – Ramy Al Zuhouri Dec 20 '12 at 12:50
  • In simulator the didUpdateToLocation delegate method repeatedly calling but in device only when the application is launched it updates 4 or 5 times. afterwards its not updating could u help me please – dineshprasanna Dec 20 '12 at 12:56

2 Answers2

0

If you are using location accuracy as 'kCLLocationAccuracyBestForNavigation', your device should remain plugged in.

Better you set it as 'kCLLocationAccuracyBest'. Also move to significant distance to hit the delegate. initially it will hit 4-5 times to locate you. Once your location is identified, it will call the delegate when there will be change in your location.

So, in delegate write something in file stored in documents directory in append mode. log the lat/long and Time details into it. Now move for some distance.

Join the mobile and get the file from documents directory. It must have logg the required details.

Apurv
  • 17,116
  • 8
  • 51
  • 67
0

Here i solved this problem using this delegate method

- (void)locationManager:(CLLocationManager *)manager
     didUpdateLocations:(NSArray *)locations{
}
dineshprasanna
  • 1,284
  • 4
  • 20
  • 37