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

  • Home
  • SEARCH
  • 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 7544335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:38:54+00:00 2026-05-30T08:38:54+00:00

I’m working on an application which periodically obtains the user’s location. The big problem

  • 0

I’m working on an application which periodically obtains the user’s location. The big problem is that sometimes the app gets stuck, no more updates are delivered. Even if I (kill and) restart my app, nothing changes. (The accuracy values set for location manager are near 100-200 meters.)
BUT, when I start the Google Maps App, in a few seconds it gets a very accurate location (which is delivered to my app to if I switch back). Why ?
Here are some relevant code parts :

The timerFiredAction is called periodically by the timer.

-(void) timerFiredAction
{
    if (isStillWaitingForUpdate)
    {
         successiveTimerActivationCount ++;
         // force LM restart if value too big , e.g. 30 ( stop + start )
         return;
    }
    successiveTimerActivationCount = 0 ;
    isStillWaitingForUpdate = YES;
    /* isRecordingX is always true */ 
    if (isSignificant && isRecordingSig) [self startSignificant ];
    if (isGPS && isRecordingGPS) [self startGps];
}

// this is called in delegate method only 
-(void) timerStopLocationServices
{
    isStillWaitingForUpdate = NO;
    if (isGPS) [ self stopGps] ;
    if (isSignificant) [self stopSignificant];
}


- (void)locationManager:(CLLocationManager *)manager  didUpdateToLocation:(CLLocation *)newLocation   fromLocation:(CLLocation *)oldLocation 
{
    // verify accuracy and stuff
    if ( isStillWaitingForUpdate &&  _other_validations_ ) 
    {
    // store it
    [self timerStopLocationServices] ; 

    }

}

The start and stop methods simply verifiy if the locationmanager is nil, if yes they call createManager and then call start & stopUpdatingLocation.

The creation of the LM looks like this :

-(void)createManager
{
    @synchronized (self)
    {
    if (locationManager != nil) {
        [self releaseManager];  // stop timer, stop updating , reelase previous if exists
    } 
    locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate = self; 
    double desired;
    // accuracy is an init param, snap to one smaller constant
    // generally 100-200
    if (accuracy >= kCLLocationAccuracyThreeKilometers)   desired = kCLLocationAccuracyThreeKilometers; else
    if (accuracy >= kCLLocationAccuracyKilometer)         desired = kCLLocationAccuracyKilometer; else
    if (accuracy >= kCLLocationAccuracyHundredMeters)     desired = kCLLocationAccuracyHundredMeters; else
    if (accuracy >= kCLLocationAccuracyNearestTenMeters)  desired = kCLLocationAccuracyNearestTenMeters; else
    if (accuracy >= kCLLocationAccuracyBest)              desired = kCLLocationAccuracyBest; else        
    if (accuracy >= kCLLocationAccuracyBestForNavigation) desired = kCLLocationAccuracyBestForNavigation;

    locationManager.desiredAccuracy = desired;
    locationManager.distanceFilter = distanceFilter; 
    }
}

Did anyone experienced something like this? Any ideas are welcome 🙂
Thanks!

  • 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-05-30T08:38:55+00:00Added an answer on May 30, 2026 at 8:38 am

    I can at least confirm “blocked location managers”, though in a slightly different context:

    From my experience, if you create two location managers with different accuracy settings, start updates for both and then only stop updates for the one with the higher accuracy requirement, then the other one no longer receives any updates.

    You are apparently only using one manager, but the way your manager gets stuck seems to be the same: In the case described above, updates can also be restarted by using the map application (or any similar).

    My workaround is the following: Whenever I stop one manager, I also reset the distance filters of all others (stored in an NSSet called myCLLocationManagers), like the following:

       CLLocationManager * lm; 
       CLLocationDistance tmp;
       for (lm in myCLLocationManagers){
          tmp=lm.distanceFilter;
          lm.distanceFilter=kCLDistanceFilterNone;
          lm.distanceFilter=tmp;
       }
    

    This seems to work more reliably than my previous woraround (which was to stop and restart the managers).

    Note that kCLLocationAccuracyBestForNavigation and kCLLocationAccuracyBest are (currently) negative values, and that in general, you shouldn’t rely on the specific values of all those constants – there’s no guarantee that kCLLocationAccuracyHundredMeters==100 (although currently true). I only mention this because it appears like you are directly comparing an “accuracy” variable in meters with those constants.

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

Sidebar

Related Questions

I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from

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.