Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8335285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:37:51+00:00 2026-06-09T03:37:51+00:00

Problem is location manager is not updating location. The (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLoc fromLocation:(CLLocation

  • 0

Problem is location manager is not updating location.
The (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLoc fromLocation:(CLLocation *)oldLoc functions gets called but it displays the new location as the same old location.

Following is my piece of code:
In my viewDidLoad method i am creating the object of CLLocationManager

-(void) viewDidLoad
{

    self.locationManager = [[CLLocationManager alloc] init];
    self.locationManager.delegate = self;
    self.locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
    self.locationManager.distanceFilter = kCLDistanceFilterNone;
    // created a timer to call locationUpdate method 
    [NSTimer scheduledTimerWithTimeInterval:20 target: self selector:  @selector(locationUpdate) userInfo: nil repeats: YES];    

}

-(void)locationUpdate
{

    [self.locationManager startUpdatingLocation];

}

-(void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLoc
           fromLocation:(CLLocation *)oldLoc
{

    NSLog(@"in locationmanager did update %f",newLoc.coordinate.latitude);
    MKCoordinateRegion region = 
    MKCoordinateRegionMakeWithDistance(newLoc.coordinate, 0.01,      0.02);
    [self.mapView setRegion:region animated:YES];
    [self.locationManager stopUpdatingLocation];

}

-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation
{

    if ([annotation isKindOfClass:[MKUserLocation class]])
    {
        MKCoordinateSpan span = MKCoordinateSpanMake(0.01, 0.02);
        MKCoordinateRegion region = MKCoordinateRegionMake(mapView.userLocation.coordinate, span);
        [_mapView setRegion:region animated:YES];
        [_mapView regionThatFits:region];

    }

The value which i am getting in NSLog(@”in locationmanager did update %f”,newLoc.coordinate.latitude) is always the same even-though i had moved for more than 2 kilometers starting from current location.

Please help me to how to get exact new location whenever there is a locationupdate. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:37:53+00:00Added an answer on June 9, 2026 at 3:37 am

    You are stopping the location manager with

    [self.locationManager stopUpdatingLocation];
    

    in

    -(void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLoc
           fromLocation:(CLLocation *)oldLoc
    

    . This delegate method gets called EVERY time the user moves and can give you old (cached) data at the beginning, so by stopping it right away when you get your first location fix you probably get a cached location each time. The fix is simple, just don’t stop the location manager there but rather when your viewController disappears or at a similar useful place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created this earlier on today, but it is not working. Location manager returns
I have a strange problem that is only happening in a single location. I
Actually my problem is sometimes i can get the location and sometimes i can't
I have a problem with obtaining the current user location. Code at first works
I'm having a problem where instead of reading a text file from the location
Here's the problem html: <ul id="update-list"> <li class="update" onclick="window.location('some_url')"> <h2> some header </h2> <p>
Historical Context: This problem ended up being not at all what I thought it
Problem I am trying to get friends_location from the Facebok Graph API. I am
I've come across an odd problem with the following code: $image = new Imagick($real_location);
Can anyone explain me how to overpass these problems? Description Resource Path Location Type

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.