在我的应用程序中,我不想使用位置服务。我想在 iphone 上使用蜂窝塔三角测量来获取坐标。
请告诉我该怎么做?
使用名为startMonitoringSignificantLocationChanges
. 来自Apple 文档-
startMonitoringSignificantLocationChanges 服务可显着节省电力并提供足以满足大多数应用程序的准确性。它使用设备的蜂窝无线电来确定用户的位置并报告该位置的变化,从而使系统能够比其他方式更积极地管理电源使用情况。
所以在代码中这就是它的样子 -
self.locationManager = [[[CLLocationManager alloc] init] autorelease];
locationManager.delegate = self;
[locationManager startMonitoringSignificantLocationChanges];