热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

位置访问-应用程序不要求用户访问位置的权限-iOS11

如何解决《位置访问-应用程序不要求用户访问位置的权限-iOS11》经验,为你挑选了1个好方法。

描述

应用程序不要求用户访问位置和获取状态未确定的权限

完美地工作到iOS-10

var locationManager : CLLocationManager!

func getLocationDetails()
    {
        locationManager.delegate = self
        locationManager.desiredAccuracy = kCLLocationAccuracyBest
        locationManager.requestAlwaysAuthorization()
        locationManager.allowsBackgroundLocatiOnUpdates= true
        locationManager.startUpdatingLocation()

    }

func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus)
    {
        if status == CLAuthorizationStatus.authorizedAlways || status == CLAuthorizationStatus.authorizedWhenInUse
        {
            locationManager.startUpdatingLocation()
        }
    }

    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
    {


    }

Plist截图 在此输入图像描述

背景模式

在此输入图像描述



1> Alok..:

我已经浏览了Apple文档并找到了这个问题的解决方案.

Apple已经改变了一些指导方针来获取用户位置.

以下是视频链接:Apple-位置技术的新功能

Swift和Objective-C中的位置访问的完整代码

解:

现在我们需要在Plist中添加三个身份验证密钥:

    NSLocationAlwaysAndWhenInUseUsageDescription

    NSLocationWhenInUseUsageDescription

    NSLocationAlwaysUsageDescription

Plist看起来像: 在此输入图像描述 身份验证消息屏幕将如下所示:

在此输入图像描述

位置访问的完整代码


推荐阅读
author-avatar
书友44802979
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有