这是我的代码在我AppDelegate类为什么在iPhone SDK 4.0中未调用CLLocationManager委托?
- (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模拟器和设备。
是什么原因?
感谢@Scott Christopherson提供了一些积极的方法.....但是我们仍然成为木偶,每次有新的iPhone SDK发布时都必须更改我们的代码。总是会发现某些方法已被弃用或无法正常工作... – Biranchi 2010-06-17 05:07:13
Thanks @Scott Christopherson请投票结束这个问题....因为没有人可以解决这个问题... – Biranchi 2010-06-17 05:08:34
面对同样的问题,你确定需要40秒才能更新位置吗? – 2010-07-08 06:03:14