本文转载至http://www.cocoachina.com/bbs/read.php?tid-237825.html

 
 

1.在文件info.pilist 中导入 NSLocationWhenInUseUsageDescription

//IOS8新功能用户开启定位 
2.appDelegate中带入 #import<CoreLocation/CoreLocation.h>

3.加入下面的语句
 CLLocationManager* location = [CLLocationManager new];
 [location requestAlwaysAuthorization];

再次运行软件就可以定位了。 
原因如下:
scussion:
 *      When +authorizationStatus == kCLAuthorizationStatusNotDetermined,
 *      calling this method will trigger a prompt to request "always"
 *      authorization from the user.  If possible, perform this call in response
 *      to direct user request for a location-based service so that the reason
 *      for the prompt will be clear.  Any authorization change as a result of
 *      the prompt will be reflected via the usual delegate callback:
 *      -locationManager:didChangeAuthorizationStatus:.
 *
 *      If received, "always" authorization grants access to the user's
 *      location via any CLLocationManager API, and grants access to
 *      launch-capable monitoring API such as geofencing/region monitoring,
 *      significante location visits, etc.  Even if killed by the user, launch
 *      events triggered by monitored regions or visit patterns will cause a
 *      relaunch.
 *
 *      "Always" authorization presents a significant risk to user privacy, and
 *      as such requesting it is discouraged unless background launch behavior
 *      is genuinely required.  Do not call +requestAlwaysAuthorization unless
 *      you think users will thank you for doing so.
 *
 *      When +authorizationStatus != kCLAuthorizationStatusNotDetermined, (ie
 *      generally after the first call) this method will do nothing.
 *
 *      If the NSLocationAlwaysUsageDescription key is not specified in your
 *      Info.plist, this method will do nothing, as your app will be assumed not
 *      to support Always authorization.

大概意思就是说:IOS8 新增加了一个选项 ,如果要开启定位这个隐私选项的话 需要在Pilist导入NSLocationWhenInUseUsageDescription,然后掉用 requestAlwaysAuthorization这个方法。 此方法执行后,当要执行定位功能的时候就会触发一个询问,询问用户是否使用定位功能,如果选择是,则启动定位功能,如果选择否,则方法返回,下次还将继续询问用户。

 
 
 
 
 
级别: 侠客
 

UID: 239860
精华: 0 
发帖: 67
可可豆: 233 CB
威望: 200 点
在线时间: 507(时)
注册时间: 2013-08-28
最后登录: 2015-01-20

 
沙发 :发表于: 2014-12-01 17:16   发自: Web Page

 
 
 
 
NSLocationAlwaysUsageDescription
看了文档,应该是这个key吧 

解决ios8 webView加载的地图无法定位问题的更多相关文章

  1. 安卓 WebView加载本地图片时居中显示

    在一个项目中使用WebView显示gif图片(自定义的View无法放大gif),当图片过小时只在左侧显示,经过研究发现无论设置android:layout_gravity="center_h ...

  2. WebView加载本地html、js文件常见问题及解决办法

    声明:基于android studio平台,php语言搭建服务器 目录: 一.JavaScript脚本语言没有反应 二.alert无法弹出 三.html页面之间不能跳转 四.屏幕缩放没有达到预期效果 ...

  3. 解决WebView加载本地文件乱码

    一.问题描述 这几天现场反馈一些问题,主要是文件浏览有部分文件显示乱码,像这样: 而文件本身又是用WebView加载的,出现有的文件正常有的文件不正常. 二.问题解决 webView 加载主要有:lo ...

  4. WebView加载URL跳转到系统浏览器的解决方法

    1.问题 webview加载url跳转到系统浏览器,用户体验非常的差 2.解决方法 重写WebViewClient的shouldOverrideUrlLoading(WebView view, Str ...

  5. android中webView加载H5,JS不能调用问题的解决

    使用了html5 页面,使用webView加载后发现 超链接的锚点不可以用 为webView设置下面两句就好了: mWebView.getSettings().setDomStorageEnabled ...

  6. WebView加载HTML图片大小自适应与文章自动换行

    http://www.brighttj.com/ios/ios-webview-load-html-image-adaptive.html 在很多App中都会使用到webview,尤其是在加载新闻内容 ...

  7. Android WebView加载本地html并实现Java与JS交互

    最近做的一个项目中,用到自定义地图,将自定义地图转换成html页面,现在需要做的是如何将本地的html加载到android中,并可以实现交互. 相关讲解: 其实webview加载资源的速度并不慢,但是 ...

  8. 【iOS】WebView加载HTML图片大小自适应与文章自动换行

    在很多App中都会使用到webview,尤其是在加载新闻内容等文章形式的数据时.因为图文混编以及不同字体格式的显示,在iOS进行编辑 和显示都是一大问题(当然,iOS中也可以用CoreText进行绘制 ...

  9. iOS webview加载时序和缓存问题总结

    iOS webView的加载时序 UIWebView加载顺序: - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSU ...

随机推荐

  1. yoman搭建你的react-webpack应用

    还没有npm和node的要提前做好准备工作 做好这一切之后 我们安装yo,记住安装在全局变量中,我们需要用他的命令工具 npm install -g yo 接下来安装yo提供的react-webpac ...

  2. unity3D打造skybox淡入淡出 - 移动开发

    原地址:http://www.it2down.com/it-mobile/426479.htm 当前位置: IT异常查询网 » unity3D打造skybox淡入淡出 - 移动开发 www.it2do ...

  3. vue scoped 解决样式不生效问题

    对于添加样式不能影响子组件样式的情况使用:>>> <style scoped> .sti-inline{ display: inline; } .sti-searchfo ...

  4. 怎样写APP计划书-20150313早读课

    我们每天都会收到拥有APP创意的人们的电话和邮件,他们想知道把这样的APP做出来需要多少钱.在Calvium,我们尽可能帮助他们,但有时候 做这样的报价真的很难.询问一款APP的价值,就和询问一条绳子 ...

  5. C++ 和 java 使用 AES CBC 128 加解密

    Java 使用jce, code: import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax ...

  6. python学习笔记之pdb调试

    之前一直说要学python可还是一直停留在看的层面,昨天大神手把书教我pdb调试,说要摆脱IDE集成开发环境编程,感激不尽,立一个flag,python一定要入门! 1.进入方式 1)windows ...

  7. 你要相信你所做的一切对一个更美好的世界 Do have faith in what you are doing All for a better world

    http://www.nowamagic.net/librarys/veda/detail/2502 Do have faith in what you are doing. 先不要往下看,试试品尝上 ...

  8. python操作xml文件

    一.什么是xml? xml即可扩展标记语言,它可以用来标记数据.定义数据类型,是一种允许用户对自己的标记语言进行定义的源语言. abc.xml <?xml version="1.0&q ...

  9. RMAN异机恢复步骤及故障处理

    一.測试机安装OS+Oracle Software.包含配置oracle用户.组和环境变量(略) 二.開始异机恢复 1. 复制源库最新备份集.初始化參数.password文件到測试机 [oracle@ ...

  10. 用Darwin开发RTSP级联server(拉模式转发)(附源代码)

    源代码下载地址:https://github.com/EasyDarwin orwww.easydarwin.org 在博客 在Darwin进行实时视频转发的两种模式 中,我们描写叙述了流媒体serv ...