【问题标题】:Which Delegate method trigger on click Dont't Allow for CLLocationManager哪个委托方法在单击时触发 CLLocationManager 不允许
【发布时间】:2014-10-25 09:52:45
【问题描述】:

使用CLLocationManager它显示弹出消息

是否允许“AppName”在您不使用该应用时访问您的位置?

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

【问题讨论】:

    标签: ios objective-c delegates cllocationmanager


    【解决方案1】:

    如果用户拒绝了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;
    }
    
    
    
     }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-03
      • 2011-03-12
      • 1970-01-01
      • 1970-01-01
      • 2013-08-04
      相关资源
      最近更新 更多