iOS8 beta 5上的UIWebView中的位置服务无法正常工作 [英] Location Service in UIWebView on iOS8 beta 5 not working

查看:104
本文介绍了iOS8 beta 5上的UIWebView中的位置服务无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天我们尝试使用Xcode 6 Beta 5为我们的应用程序预览iOS 8 beta 5。
我们在混合应用程序的webview组件中使用位置服务。



我认识到通过UIWebView进行地理定位不再有效了。
我通过示例从头开始验证了这种行为


Yesterday we tried the developer previews iOS 8 beta 5 with Xcode 6 Beta 5 for our App. We use location services in the webview components of our hybrid app.

I recognized that geolocating via UIWebView ist not working anymore. I verified this behavior with an example from scratch loading example for geolocation from the w3schools.com into a UIWebView.

With iOS 7, (Base SDK 7.1, built with XCode 5), the notification for acceptance of the location service is prompted an after that, the app shows up under Privacy--> Location Services in the iPhone settings. With iOS 8, (Base SDK 8, built with XCode 6) the prompt doesn't occur and the webview location service is not working and no entry in the settings is made.

I know, that with iOS 8 some changes took place for the users privacy settings especially dealing with location services in background, but I didn't expect that it will break our webview-location logic where we make use of the navigator.geolocation.getCurrentPosition(showPosition) javascript function.

Anyway I am still not clear if this is a bug in iOS 8 beta or the result of some API changes and if, what would be the right way to adopt.

Thanks in advance

解决方案

I had the same problem on ios 8.3.

I solved the problem by adding NSLocationWhenInUseUsageDescription IN Custom iOS Target Properties. It is this website that helped me: http://www.touch-code-magazine.com/working-easily-location-ios8-swift-oneshotlocationmanager/

这篇关于iOS8 beta 5上的UIWebView中的位置服务无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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