Reputation: 913
For my app i need to access the GPS latitude and longitude coordinates when there is no internet connection in device. I used CLLocation to achieve this. But when i switch off the wifi and internet in device locationmanager is showing
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
NSLog(@"didFailWithError %@", error);
}
The error i got is Error Domain=kCLErrorDomain Code=0 "the Operation could't be completed"
Once i get the proper user location how to refresh the app when the user moves from the current location?
I have downloaded the code of this tutorial http://www.vellios.com/2010/08/16/core-location-gps-tutorial/ but i got the same error.
Anyone please let me know how to achieve the GPS when offline, no internet. Thanks
Upvotes: 1
Views: 5128
Reputation: 4291
Have you tried this?
[locationManager setDistanceFilter:kCLDistanceFilterNone];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
Upvotes: 0
Reputation: 2132
The Basics of How Location Services Determines Your Location Apple iOS uses a three-stage algorithm in order to determine your location:
Assisted Global Positioning System (A-GPS)
Crowdsourced Wi-Fi
Cellular network search
These three stages are used in descending order of priority. In other words, iOS first attempts to fix your location by using a GPS satellite link. If it is unable to acquire a satellite, iOS fails over to Wi-Fi. If you are not connected to a Wi-Fi local area network (WLAN), then iOS uses cell tower data. If all of the above fail, then you receive an error message such as what you see in the following figure.
Assisted GPS (A-GPS) shortens the time that it typically takes for a GPS client device to acquire a connection to a satellite. For instance, my morning runs are sometimes delayed by several minutes while I wait for my Garmin GPS training watch to connect to a satellite. Imagine how painful it would be to wait several minutes for your iPhone to make a GPS connection!
Essentially, your iDevice caches periodic snapshots of satellite data in order to speed up connection time. Obviously, you will observe the snappiest GPS performance when you are outside and away from sources of interference such as tall buildings or even the interior of your vehicle.
Crowdsourced Wi-Fi means that your iDevice again caches information not only regarding the WLAN to which you are currently connected, but also regarding any other WLANs within range of your device. By storing WLAN service set identifiers (SSIDs) and media access control (MAC) address information locally, this allows iOS location services to pinpoint your location much faster through triangulation.
The idea is that if iOS detects that you are connected to your home WLAN and it already has the global positioning coordinates of that location, location services can display your location without having to work through GPS connection or Wi-Fi triangulation.
Cellular Network Search involves the notion of “triangulation” again, this time with iOS using cached information regarding your nearby cellular towers. By the way, triangulation is a geometry principle that determines the location of a point by measuring angles to it from known points at either end of a fixed baseline. For instance, iOS can approximate your location by measuring distances between your iDevice and a number of cell towers that are nearby.
Upvotes: 1