可能是重复问题:
是否可以手动调用警告“允许使用当前位置”?
在我的应用程序中,所有功能都基于用户的当前位置。受众不包括技术极客。
当用户第一次启动应用程序时,我考虑到用户不太确定它能做什么,他可能会对应用程序的“是否允许使用您的当前位置?”感到困惑。如果他选择了“不允许”,屏幕上将没有任何数据。
现在我处理的方法是:
- (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再次请求当前位置?