0
votes

Does anyone know what could cause locationManager to not converge to a value even though Location Services are on?

Edit 1 - The locationManager works fine for some users, but for other users their location never gets updated. And the user's device, whose location never gets updated, has GPS since the devices are iPhone 5, iPad3, iPhone 4, etc. I'm wondering if they are too far out in the country and always indoors. so GPS, WiFi, cell towers don't reach them? But somehow they get online....

Edit 2 - More clarification: The user has internet access as they are able to make a new account on my web server. And when locationManager has converged on a value, using #2 below, then the gps location on my web server is updated but that never happens. The user is on the device in the app long enough to answer 10 questions and upload their photo. Is that not enough time for locationManager to converge if the user has internet access?

Edit 3 - Another weird thing happens: On the website when the user's account is created, the users's gps_lat is set to 0. When the user does update his gps_lat on the website using locationManager from the iPhone, the updated value for gps_lat is (null). What could cause locationManager to produce output = (null)?

  1. I check that Location Services are on with the following code:

     BOOL locationServicesDenied    = ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied);
    
  2. Then I update the user's location on the website when the locationManager has converged with this code:

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

    if((newLocation.horizontalAccuracy >  0.0f) && (newLocation.horizontalAccuracy < 7000.0f){
             [self update_website:self];
        } 
    

But update_website never gets called. Which makes me think that the newLocation.horizontalAccuracy never gets below 7000.

Does anyone have any idea why locationManager fails to converge even though Location Services are on?

2
It's likely that that delegate method is never getting called. You may be getting a location services error. Implement the other delegate methods and check to see which one is called, if any. - progrmr
I added an Edit indicating that the delegate method gets called for some users, since their gps data gets updated. Is there something that would stop the delegate method from getting called for some users, but called for other users? - James Testa
If there is no error and the GPS can't get a location, the delegate won't get called. The GPS will keep trying to get a location but if the device is underground (for example), it will get nothing (unless there was a cached location). - progrmr

2 Answers

3
votes

Have you set the location manager's delegate property and called startUpdatingLocation on it?

[myLocationManager setDelegate:self];
[myLocationManager startUpdatingLocation];

Edit: I thought this was just happening on a test device. If it's on user devices, it's entirely possible that the accuracy could be over 7000m. If the only thing being used for the fix is the cellular radio (no GPS, no WiFi) the accuracy is around 1-10k depending on the density of cell towers. The user being online (either ethernet or WiFi) doesn't guarantee that their WiFi is in the database of known (and mapped) points.

0
votes

If there is no error and the GPS doesn't have enough of a signal to compute a location, the delegate won't get called. The GPS will keep trying to get a location but if the device is underground (for example), it will get nothing (unless there was a cached location).

Are you waiting long enough? Even if the device has a GPS signal but there is no data network (WiFi/Cell), then the location manager can't get the satellite ephemeris via the data network. It will take much longer to get a GPS location, anywhere from 2-10 minutes. Assisted-GPS is much faster but requires a data connection.