再次提出"应用程序想要使用您当前位置"对话框

Chr*_*len 9 alert core-location ios

可能重复:
是否可以手动调用警报"允许使用当前位置"?

在我的应用程序中,所有功能都基于用户的当前位置.观众是除了怪异之外的一切.

我认为用户首先启动应用程序 - 因为用户不确定它能做什么,他/她可能会对应用程序"想要使用您当前位置?"感到困惑.如果他回答"不允许",他将不会在屏幕上获得任何数据.

现在我处理:

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

    if (error.code ==  kCLErrorDenied) {
        NSLog(@"Location manager denied access - kCLErrorDenied");

        UIAlertView *alert = 
              [[UIAlertView alloc] initWithTitle:@"Location issue" 
                                         message:@"Your location cannot be determined." 
                                        delegate:self 
                               cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];
        [alert release];
    } 
}   
Run Code Online (Sandbox Code Playgroud)

好的,该应用程序有一个Reload-Button.假设用户点击该重新加载按钮,系统将不会再次询问他以启用基于位置的服务.

我怎么能强迫iOS再次询问当前位置?

Raf*_*fAl 0

您无法强制再次显示此对话框。iOS 将在应用程序下次启动时再次询问用户。我所说的启动并不是指在应用程序发送到后台后进入前台。