【问题标题】:Requesting in use authorization shows no prompt请求使用授权无提示
【发布时间】:2014-11-14 05:19:36
【问题描述】:

我有

NSLocationWhenInUseUsageDescription

和

NSLocationAlwaysUsageDescription

在我的 Info.plist 中定义。

在我的代码中

    if ([_locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
        [_locationManager requestWhenInUseAuthorization];
    }

    [_locationManager startUpdatingLocation];

而且我在 iOS8 上没有收到提示。

我在我的模拟器中进行了全新的重新安装。在没有 3 if 块的 iOS7 上,我收到提示。

在 startUpdatingLocation 之后,我检查了[CLLocationManager authorizationStatus],即0- kCLAuthorizationStatusNotDetermined

如何提示iOS8用户?

【问题讨论】:

    标签: ios8 core-location


    【解决方案1】:

    4 ios 8:需要在info.plist中配置,

    键名称为“NSLocationAlwaysUsageDescription”,值为“”

    键名称为“NSLocationWhenInUseUsageDescription”,值为“”

    当你打电话时:

    [_locationManager requestWhenInUseAuthorization];
    

    将自动提示。

    用模拟器测试,可以点击“Reset content and settings...”再次提示。

    这是一个演示:https://github.com/JNYJ/001PGWUcurrentWULF

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-20
      • 2021-12-04
      • 2015-08-19
      • 2017-05-11
      • 1970-01-01
      • 1970-01-01
      • 2023-03-11
      • 2014-04-08
      相关资源
      最近更新 更多