单击哪个Delegate方法单击“不允许CLLocationManager”

时间:2014-10-25 09:52:45

标签: ios objective-c delegates cllocationmanager

使用CLLocationManager显示弹出消息

即使您没有使用该应用,也允许“AppName”访问您的位置?

有两个选项不允许允许点击允许触发didUpdateLocations点击不允许是它调用的委托方法吗?

1 个答案:

答案 0 :(得分:2)

如果用户拒绝权限didFailWithError已调用且错误类型

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

   // [manager stopUpdatingLocation];
    NSLog(@"error%@",error);
    switch([error code])
{
    case kCLErrorNetwork: // general, network-related error
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Location Error!" message:@"Can't access your current location! Please check your network connection or that you are not in airplane mode!" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
        [alert show];

    }
        break;
    case kCLErrorDenied:{
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Location Error!" message:@"Location Access has been denied for app name!" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
        // alert.tag=500;
        [alert show];

    }
        break;
    default:
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Location Error!" message:@"Can't access your current location!" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
        [alert show];

    }
        break;
}



 }