Location Service in UIWebView on iOS8 beta 5 not working

房东的猫 提交于 2019-12-09 13:48:11

问题


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


回答1:


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/

来源:https://stackoverflow.com/questions/25176750/location-service-in-uiwebview-on-ios8-beta-5-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!