Dies ist der Code, den ich in meiner AppDelegate-Klasse habe
- (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];
}
Und dies ist die Delegate-Methode, die ich in meiner AppDelegate-Klasse habe
//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);
}
Es funktioniert in 3.0, 3.1, 3.1.3, aber es funktioniert nicht in 4.0 Simulator und Gerät beide.
Was ist der Grund dafür?