可能的重复:
是否可以手动调用警报“允许使用当前位置”? https://stackoverflow.com/questions/3749648/is-it-possible-to-call-alert-allow-to-use-current-location-manually
在我的应用程序中,所有功能都基于用户当前位置。观众不仅仅是极客。
我认为用户第一次启动应用程序 - 由于用户不太确定它可以做什么,她/他可能会对应用程序的“想要使用您当前的位置吗?”感到困惑。如果他回答“不允许”,他将不会在屏幕上看到任何数据。
现在我处理:
- (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];
}
}
好的,该应用程序有一个重新加载按钮。假设用户点击重新加载按钮,系统将不会再次要求他启用基于位置的服务。
我如何强制 iOS 再次询问当前位置?
您无法强制再次显示此对话框。 iOS 将在应用程序下次启动时再次询问用户。我所说的启动并不是指在应用程序发送到后台后进入前台。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)