相关疑难解决方法(0)

为什么在iPhone SDK 4.0中没有调用CLLocationManager委托?

这是我在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];
}
Run Code Online (Sandbox Code Playgroud)

这是我在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);

}
Run Code Online (Sandbox Code Playgroud)

它工作在3.0,3.1,3.1.3,但它不适用于4.0模拟器和设备.

是什么原因 ?

iphone core-location cllocationmanager cllocation

12
推荐指数
1
解决办法
2万
查看次数