IOS CoreLocation does not work over 3G only in the USA

My application cannot determine lat / long coordinates via 3G in North America. It works great when connected to Wi-Fi. This is confirmed by both AT&T and Verizon with iOS 5. In the UK, it works as expected on both 3G and Wi-Fi with o2.

I really am a dead end as to what could be causing. I think my code is pretty simple in terms of accuracy, but since I'm on the other side of the pond, could I be aloof?

Are there any blatant errors in my code? (I removed some unrelated methods).

static NSTimeInterval MaxLocationAge = 60.0; // Seconds. static CLLocationAccuracy DesiredHorizontalAccuracy = 200.0; // Meters. static NSTimeInterval UpdateTimeout = 30.0; // Seconds. @implementation AFLocation @synthesize locationManager = _locationManager, delegate = _delegate, bestEffortAtLocation = _bestEffortAtLocation, updateStartedAt = _updateStartedAt; - (id)init { self = [super init]; if (self) { CLLocationManager *manager = [[CLLocationManager alloc] init]; self.locationManager = manager; [manager release]; self.locationManager.delegate = self; self.locationManager.distanceFilter = kCLDistanceFilterNone; self.locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation; } return self; } - (void)update { self.updateStartedAt = [NSDate date]; isUpdating = YES; [self.locationManager startUpdatingLocation]; } - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { if ([[NSDate date] timeIntervalSinceDate:self.updateStartedAt] > UpdateTimeout) { [self.locationManager stopUpdatingLocation]; if (isUpdating) { [self updateDidTimeout]; } isUpdating = NO; } NSTimeInterval locationAge = -[newLocation.timestamp timeIntervalSinceNow]; if (locationAge > MaxLocationAge) { return; } if (newLocation.horizontalAccuracy < 0) { return; } if (self.bestEffortAtLocation == nil || self.bestEffortAtLocation.horizontalAccuracy > newLocation.horizontalAccuracy) { self.bestEffortAtLocation = newLocation; if (newLocation.horizontalAccuracy <= DesiredHorizontalAccuracy) { self.bestEffortAtLocation = nil; isUpdating = NO; [self.locationManager stopUpdatingLocation]; [self didUpdateWithDesiredAccuracyToLocation:newLocation]; } } } @end 
+4
source share
2 answers

WiFi and 3G are used only to speed up the process of obtaining high accuracy (<300 m). Without an Internet connection, it may take 3-10 minutes to fix the use of GPS. (They are used for low-accuracy corrections using a mesh tower or Wi-Fi triangulation, and to download satellite ephemeris data to speed up GPS signal collection).

The initial fix with Wi-Fi or 3G may have the expected accuracy of 800 m, but if the device has a 3G connection (or WiFi or Edge) and can receive fairly strong signals from GPS satellites, it should be able to receive GPS within 20-90 seconds .

Perhaps you are using an application that does not wait long enough, or the user has a weak GPS signal, or there is a device without GPS (i.e. iPhone1 or iPod Touch or non-3G iPads). In this case, they will not get the required accuracy of 200 m.

+1
source

You have set the CLLocationManager to use the required kCLLocationAccuracyBestForNavigation accuracy, but you are comparing the location accuracy with an arbitrary accuracy of 200 meters. If kCLLocationAccuracyBestForNavigation is an opaque type, how do you know that a manager even strives for your accuracy of 200 meters? When I receive location updates, I check if the accuracy set by my location manager is not less or equal.

0
source

Source: https://habr.com/ru/post/1385188/


All Articles