我想在打开应用程序时显示位置权限对话框(我稍后检索实际位置)。我可以通过执行以下操作来假装检索位置:
if(firstApplicationLaunch){
firstApplicationLaunch = NO;
locationManager = [[CLLocationManager alloc] init];
[locationManager startUpdatingLocation];
[locationManager stopUpdatingLocation];
}
答案 0 :(得分:1)
是的,这将在启动时强制执行位置权限对话框。但是,在用户响应对话框之前,您需要注意不要释放CLLocationManager
或让它超出范围,否则对话框将消失。