繁体   English   中英

iOS:启动应用程序时不显示位置服务授权警报视图

[英]iOS: location services authorization alert view is not displayed when app is started

我几天前问了这个问题,关于我的应用在重新安装后没有显示在“设置”>“位置服务”下。 我发现,重新安装后,我必须运行该应用程序并等待显示“使用当前位置”授权警报视图,以使该应用程序显示在“位置服务”列表下。 反过来,我发现我的应用在启动时不会立即显示此警报视图。

这是可能是问题的一些代码:

-(void)restartGps: (UIWebvView *)curWebView {
  [locationManager startMonitoringSignificantLocationChanges];
  [self performSelector:@selector(noGpsLock:) withObject:curWebView afterDelay:GPS_TIMEOUT];
}

-(void)noGpsLock: (UIWebView *)curWebView {
  if (!hasLocationFix) {
    [locationManager stopMonitoringSignificantLocationChanges];
    [self performSelector:@selector(restartGps:) withObject:curWebView afterDelay:GPS_TIMEOUT];
  }
}

-locationManager:didUpdateToLocation:fromLocation:时, -locationManager:didUpdateToLocation:fromLocation:设置为TRUE。

我最初在viewDidLoad调用restartGps:然后让这两个方法相互调用。 我发现第一次(从viewDidLoad )调用restartGps: ,没有出现警报,因此应用程序无法获得任何位置。 经过noGpsLock:restartGps调用后,警报最终出现,并且该应用程序能够获取位置。

为什么在首次启动restartGps:时未显示警报?

也许此链接可以帮助您

添加与方向相关的事件的要求

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM