This is the code that I have in my AppDelegate Class
- (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];
}
And this is the delegate method i have in my AppDelegate Class
//This is the delegate method for CoreLocation
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
//printf("AppDelegate latitude %+.6f, longitude %+.6f
", newLocation.coordinate.latitude, newLocation.coordinate.longitude);
}
Its working in 3.0, 3.1, 3.1.3 , but its not working in 4.0 simulator and device both.
What is the reason ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…