【发布时间】:2011-03-04 18:55:36
【问题描述】:
这是我的 AppDelegate 类中的代码
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.distanceFilter = 1000; // 1 Km
locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;
[locationManager startUpdatingLocation];
}
这是我的 AppDelegate 类中的委托方法
//This is the delegate method for CoreLocation
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
//printf("AppDelegate latitude %+.6f, longitude %+.6f\n", newLocation.coordinate.latitude, newLocation.coordinate.longitude);
}
它可以在 3.0, 3.1, 3.1.3 中运行,但它不能在 4.0 模拟器和设备中运行。
是什么原因?
【问题讨论】:
-
在这里遇到同样的问题,你确定更新位置大约需要 40 秒?
-
有人找到解决方案了吗???
标签: iphone core-location cllocationmanager cllocation