【问题标题】:Bring up the "App Would Like to Use Your Current Location" dialogue again [duplicate]再次调出“应用程序想使用您当前的位置”对话框[重复]
【发布时间】: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


【解决方案1】:

您无法强制此对话框再次显示。 iOS 将在应用程序的下一次启动时再次询问用户。启动并不是指应用发送到后台后进入前台。

【讨论】:

    【解决方案2】:

    目前,执行此操作的唯一快速方法似乎是要求用户重新启动应用程序然后崩溃(或设置 UIApplicationExitsOnSuspend 键并启动 Safari)。当用户重新启动应用程序时,该对话框将可用。

    这可能会或可能不会在 Apple 审核时立即拒绝您的应用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-15
      • 1970-01-01
      • 2013-10-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-08
      • 2021-04-14
      • 2021-08-21
      相关资源
      最近更新 更多