views:

81

answers:

1

Good Day!

I have a question regarding iphone development. i am building an app for iphone which uses gps, i can tackle the gps from my app via alert that whether user wants to use gps or not. as you know when it will try to use gps, iphone's built in gps will ask as well whether to allow it to use or not. so here is my question that how can i know that user clicked the iphone's built in pop up

because i am showing "Gps not working" alert on failure. so how can i let alert popup when only gps is not working and not when the user clicks "he does not want to use gps"

A: 

implement

- (void)locationManager: (CLLocationManager *)manager
       didFailWithError: (NSError *)error

delegate method... if error code is = kCLErrorNetwork then it is gps error and if error code = kCLErrorDenied then user has denied... you can put switch case like

switch([error code])
    {
        case kCLErrorNetwork: // general, network-related error
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"please check your network connection or that you are not in airplane mode" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
            [alert show];
            [alert release];
        }
        case kCLErrorDenied:{
            //User has denied 
            return;
        }...
mihirpmehta
Perfect Thanks very much
Ch Sab