如何第二次请求用户许可以允许访问当前位置?

Azi*_*lah 4 iphone objective-c core-location cllocationmanager ios

在我的应用程序中,如果用户不允许访问其当前位置,我可以通过以下方法接收该消息

- (void)locationManager:(CLLocationManager*)aManager didFailWithError:(NSError*)anError
{
    switch([anError code])
    {
       case kCLErrorLocationUnknown: 
        break;

        case kCLErrorDenied:
        {
           UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Access Denied" message:@"You didn't allow to access your current location" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
            [alert show];
          break;
        }
    }
 }
Run Code Online (Sandbox Code Playgroud)

如何第二次询问用户权限?

我搜索并得到答案否,如果用户希望应用程序访问他/她的位置,他/她如何设置应用程序以使用他们当前的位置?

是删除应用程序并下载另一个唯一的解决方案?

Sha*_*yrs 5

这只是我还是什么?有几个这样的问题.每个用户都应该通过什么来重新启用位置服务来回答,而不是程序员应该做什么来获得宝贵的一致警报.

呼叫

[singleton.locationManager startUpdatingLocation];
Run Code Online (Sandbox Code Playgroud)

这实际上是警报的爆发.

如果您不打电话,则警报不会显示.

如果您首先检查它是否已启用,然后仅在启用时才调用它,则警报不会显示.

我花了几周时间搞清楚这一点.在互联网上没有任何关于此的信息.