应用程序首次打开时显示位置权限对话框

时间:2013-10-16 16:59:10

标签: ios objective-c

我想在打开应用程序时显示位置权限对话框(我稍后检索实际位置)。我可以通过执行以下操作来假装检索位置:

    if(firstApplicationLaunch){
       firstApplicationLaunch = NO;
       locationManager = [[CLLocationManager alloc] init];
       [locationManager startUpdatingLocation];
       [locationManager stopUpdatingLocation];
    }

1 个答案:

答案 0 :(得分:1)

是的,这将在启动时强制执行位置权限对话框。但是,在用户响应对话框之前,您需要注意不要释放CLLocationManager或让它超出范围,否则对话框将消失。

相关问题