没有互联网时,用户位置GPS坐标 [英] user location GPS coordinates when no internet

查看:60
本文介绍了没有互联网时,用户位置GPS坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的应用程序,当设备中没有互联网连接时,我需要访问GPS纬度和经度坐标.我使用CLLocation实现了这一点.但是,当我关闭设备locationmanager中的wifi和互联网时,显示

 -(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error{NSLog(@"didFailWithError%@",错误);} 

我得到的错误是Error Domain = kCLErrorDomain Code = 0操作无法完成"

一旦我获得了正确的用户位置,当用户从当前位置移动时如何刷新应用程序?

我已经下载了本教程的代码 http://www.vellios.com/2010/08/16/core-location-gps-tutorial/,但我遇到了同样的错误.

任何人请让我知道如何在离线,没有互联网的情况下实现GPS.谢谢

解决方案

位置服务如何确定您的位置的基础知识Apple iOS使用三阶段算法来确定您的位置:

  1. 辅助全球定位系统(A-GPS)

  2. 众包Wi-Fi

  3. 蜂窝网络搜索

这三个阶段按优先级从高到低的顺序使用.换句话说,iOS首先尝试使用GPS卫星链接来固定您的位置.如果无法获取卫星,则iOS将故障转移到Wi-Fi.如果您未连接到Wi-Fi局域网(WLAN),则iOS使用手机信号塔数据.如果以上所有方法均失败,则您将收到一条错误消息,如下图所示.

辅助GPS(A-GPS)缩短了GPS客户端设备获取与卫星的连接所需的时间.例如,在我等待Garmin GPS训练表连接到卫星时,有时我的晨跑有时会延迟几分钟.想象一下,等几分钟让您的iPhone建立GPS连接将是多么痛苦!

从本质上讲,您的iDevice会缓存卫星数据的定期快照,以加快连接时间.显然,当您在外面并且远离干扰源(例如高楼大厦或车辆内部)时,您将观察到最出色的GPS性能.

众包Wi-Fi意味着您的iDevice再次不仅缓存有关您当前连接的WLAN的信息,而且还缓存有关设备范围内的任何其他WLAN的信息.通过在本地存储WLAN服务集标识符(SSID)和媒体访问控制(MAC)地址信息,这使得iOS定位服务可以通过三角测量更快地定位您的位置.

这个想法是,如果iOS检测到您已连接到家庭WLAN,并且已经具有该位置的全球定位坐标,则位置服务可以显示您的位置,而无需通过GPS连接或Wi-Fi三角测量./p>

蜂窝网络搜索再次涉及三角测量"的概念,这次是在iOS中,使用有关附近蜂窝塔的缓存信息.顺便说一句,三角剖分是一种几何原理,它通过从固定基线任一端的已知点测量与该角度的角度来确定该点的位置.例如,iOS可以通过测量iDevice与附近多个手机发射塔之间的距离来估算您的位置.

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

解决方案

The Basics of How Location Services Determines Your Location Apple iOS uses a three-stage algorithm in order to determine your location:

  1. Assisted Global Positioning System (A-GPS)

  2. Crowdsourced Wi-Fi

  3. 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.

这篇关于没有互联网时,用户位置GPS坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆