I have been using the location class as a delegate class and using my AppDelegate to update the location. I need the location on two cases: first at the time when he first signed into my application and then the next case is when he come from background. I am using UILocation
like this in the first case:
locationController = [[UILocation alloc] init];
locationController.delegate = self;
locationController.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
locationController.locationManager.distanceFilter = kCLDistanceFilterNone;
[locationController.locationManager startUpdatingLocation];
and in the second case simply:
[locationController.locationManager startUpdatingLocation]
in my delegate method:
- (void)locationUpdate:(CLLocation *)location
In my delegate class I am doing this:
[locationController.locationManager stopUpdatingLocation];
after taking the lattitude and longitude. But it still updates after calling this.
I tried
locationController.locationManager=nil;
locationController.locationManager.delegate=nil
after stopping the update. But after this when I call startUpdateLocation, my delegate method is not called. Can anybody point me in what I am going wrong?