2

在 android 中有方法getLastKnownLocation(),它获取设备上最后获取的更新位置。

关键是这个位置甚至不需要从你的应用程序中获取。

我需要在 IOS 中做同样的事情,所以我需要从设备获取的最后一个位置,即使它不是来自我的应用程序(因为我需要的位置根本不需要精确)

谢谢你。

4

2 回答 2

0

没有全局范围,您可以要求最后一个已知位置。如果您的应用程序需要位置信息,那么您的应用程序将使用 CLLocationManager 及其委托方法,因此别无他法。

请注意,其中涉及一些缓存,只需检查 CLLocation 对象的时间戳 - locationManager:didUpdateToLocation:fromLocation:

马丁

于 2012-08-30T10:30:28.233 回答
0

我正在解决以下问题:

我创建了一个 GpsManager 类,例如:

@interface GpsManager : NSObject <CLLocationManagerDelegate>
@property (nonatomic, retain) CLLocationManager *locationManager;
@property (nonatomic, retain) CLLocation *location;
+(GpsManager*) getShared;
@end

我在appdelegate上启动它,这个类将保存位置并且你可以使用它,它不像android的getLastKnownLocation()那样实用,但希望有点。

于 2012-11-27T14:37:40.660 回答