views:

26

answers:

0

"HELLO, GREAT TUTORIAL MAN.. BUT I HAVE SOME ERROR REGARDING THE LOCATION MANAGER.

BELOW IS MY CODE SNIPPET.

  • (CLLocationManager *)locationManager {

if (locationManager != nil) { return locationManager; }

locationManager = [[CLLocationManager alloc] init]; [locationManager setDelegate:self]; locationManager.distanceFilter = kCLDistanceFilterNone; [locationManager setDesiredAccuracy:kCLLocationAccuracyHundredMeters]; [locationManager startUpdatingLocation]; return locationManager; }

  • (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {

mUserCurrentLocation = [[CLLocation alloc] init]; self.mUserCurrentLocation = newLocation; [self uploadUserCurrentLocationToServer];

[manager stopUpdatingLocation]; }

  • (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {

NSLog(@"Error: %@", [error description]);

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error getting Current Location" message:@"Please check your Internet connection" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; [alertView show]; [alertView release]; }

IN ABOVE CODE, I GET THE ALERT FOR ERROR. WHICH IS IN DIDFAILWITHERROR METHOD. THIS MEANS THAT THERE MUST BE SOME FAULT WITH MY ABOVE CODE FOR LOCATION MANAGER.

SO WOULD YOU PLEASE HELP ME TO FIND THE USER'S CURRENT LOCATION.

THANK YOU. WAITING FOR YOUR REPLY...