请求使用授权显示没有提示 [英] Requesting in use authorization shows no prompt

查看:241
本文介绍了请求使用授权显示没有提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有

NSLocationWhenInUseUsageDescription

NSLocationAlwaysUsageDescription

在我的Info.plist中定义。

defined in my Info.plist.

在我的代码中我做了

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

    [_locationManager startUpdatingLocation];

我不会在iOS8上收到提示。

And I don't get prompted on iOS8.

我在我的模拟器中做了一个干净的重新安装。在没有3 if块的iOS7上,我会收到提示。

I did a clean reinstall in my simulator. On iOS7 without the 3 if block I get prompted.

在startUpdatingLocation之后我检查 [CLLocationManager authorizationStatus] 这是 0- kCLAuthorizationStatusNotDetermined

Right after startUpdatingLocation I check [CLLocationManager authorizationStatus] which is 0- kCLAuthorizationStatusNotDetermined

如何提示iOS8用户?

How do I prompt iOS8 users?

推荐答案

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

4 ios 8: Need configure it in info.plist,

键名为NSLocationAlwaysUsageDescription值为

key name as "NSLocationAlwaysUsageDescription" value as ""

密钥名称为NSLocationWhenInUseUsageDescription值为

key name as "NSLocationWhenInUseUsageDescription" value as ""

当您致电:

[_locationManager requestWhenInUseAuthorization];

将自动提示。

测试使用模拟器,您可以单击重置内容和设置...并再次提示。

Testing with simulator, you can click "Reset content and settings..." and prompt again.

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

这篇关于请求使用授权显示没有提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆