zoukankan      html  css  js  c++  java
  • os8 location authorization 错误.

    今天在XCode6上打开之前写的地图时,给我报这个错 location authorization

    去网上查了一番,才知道Xcode6对地图的设置稍有修改
    在stackoverflow上找到了答案 iOS 8 : Location Services not working

    我权当翻译一遍,记录一下.

    解决这个问题一般两个步骤。

    1 在工程info。plist文件中添加下面值,任意一个

    >	<key>NSLocationWhenInUseUsageDescription</key>
    	<string>The spirit of stack overflow is coders helping coders</string>
    
    	<key>NSLocationAlwaysUsageDescription</key>
    	<string>I have learned more on stack overflow than anything else</string>
    

    value值随意填,会在请求用户授权时,显示给用户.

    2 接着就在工程中加入这几行代码

          if ([self.locationManager 	respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
    
      [self.locationManager requestWhenInUseAuthorization];
    }
    	[self.locationManager startUpdatingLocation];
    

    至于这个就看之前填的是哪个,永久还是每次都需要授权
    requestWhenInUseAuthorization

    另,英文还可以的推荐直接看这篇,讲解的很好Core Location Manager Changes in iOS 8

  • 相关阅读:
    Vue 项目目录结构分析
    Vue 项目环境搭建
    Vue 组件
    Vue 指令
    Vue 实例成员
    Django 静态文件
    MySQL 索引详解
    Django 请求生命周期
    18. 4Sum (JAVA)
    16. 3Sum Closest (JAVA)
  • 原文地址:https://www.cnblogs.com/myqiqiang/p/4047574.html
Copyright © 2011-2022 走看看