简体   繁体   English

iOS8 beta 5上的UIWebView中的位置服务无法正常工作

[英]Location Service in UIWebView on iOS8 beta 5 not working

Yesterday we tried the developer previews iOS 8 beta 5 with Xcode 6 Beta 5 for our App. 昨天我们尝试开发人员使用Xcode 6 Beta 5为我们的App预览iOS 8 beta 5。 We use location services in the webview components of our hybrid app. 我们在混合应用程序的webview组件中使用位置服务。

I recognized that geolocating via UIWebView ist not working anymore. 我认识到通过UIWebView进行地理定位不再适用了。 I verified this behavior with an example from scratch loading example for geolocation from the w3schools.com into a UIWebView. 我通过一个示例来验证这种行为,从w3schools.com到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. 使用iOS 7(基本SDK 7.1,使用XCode 5构建),接收位置服务的通知在此之后被提示,该应用程序显示在iPhone设置中的隐私 - >位置服务下。 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. 使用iOS 8(基本SDK 8,使用XCode 6构建),不会出现提示,并且webview位置服务不起作用,并且设置中没有条目。

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. 我知道,在iOS 8中,用户隐私设置发生了一些变化,特别是在后台处理位置服务,但我没想到它会破坏我们使用navigator.geolocation.getCurrentPosition的webview-location逻辑。 (showPosition)javascript函数。

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. 无论如何,我仍然不清楚这是iOS 8测试版中的错误还是某些API更改的结果以及是否采用的正确方法。

Thanks in advance 提前致谢

I had the same problem on ios 8.3. 我在ios 8.3上遇到了同样的问题。

I solved the problem by adding NSLocationWhenInUseUsageDescription IN Custom iOS Target Properties . 我通过在自定义iOS目标属性中添加NSLocationWhenInUseUsageDescription来解决了这个问题。 在此输入图像描述在此输入图像描述 It is this website that helped me: http://www.touch-code-magazine.com/working-easily-location-ios8-swift-oneshotlocationmanager/ 这个网站帮助了我: http//www.touch-code-magazine.com/working-easily-location-ios8-swift-oneshotlocationmanager/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM