Wednesday 27 November 2019

ios - iPhone - LocationManager doesn't converge even though a user's Location Services are on?

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?

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...