【发布时间】:2012-01-18 18:53:10
【问题描述】:
可能重复:
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 core-location alert