地理定位在 iOS 8 模拟器中不起作用

Geolocation is not working in iOS 8 simulator(地理定位在 iOS 8 模拟器中不起作用)
本文介绍了地理定位在 iOS 8 模拟器中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经按照这篇文章升级了 cordova 3.5 中的地理定位插件以解决 iOS 8 中的问题.

I have upgraded the geolocation plugin in cordova 3.5 to fix the issue in iOS 8 by following this post.

http://shazronatadobe.wordpress.com/2014/09/18/cordova-ios-and-ios-8/

在 iOS8 模拟器中运行应用程序后,我收到通知允许MyApp"在您使用应用程序时访问您的位置?但是在允许定位服务使用该应用后,它仍然显示错误 locationManager::didFailWithError (null).我试图关闭模拟器并一次又一次地运行它.此外,通过检查模拟器中的设置,位置服务似乎处于活动状态(设置 > 隐私 > 位置服务 > MyApp > 使用时).通过在 iOS 7 模拟器中运行相同的应用程序可以正常工作并且能够检测 lat/lng.

After running the app in iOS8 simulator, I am getting the notification 'Allow "MyApp" to access your location while you use the app?' But it still shows the error locationManager::didFailWithError (null) after allowing the location service to use the app. I have tried to close the simulator and run it again and again. Also it seems that location service is active (Settings > Privacy > Location services > MyApp > While Using) by checking the settings in the simulator. By running the same app in iOS 7 simulator is working fine and able to detect the lat/lng.

仅供参考:我正在使用 Xcode 6 构建应用程序.

FYI: I am using Xcode 6 to build the application.

任何帮助/建议都会有所帮助.

Any help/suggestion will be helpful.

推荐答案

听起来很奇怪,但至少在我的 Xcode 6 项目上确实有效.还要确保将所需的密钥添加到您的 Projectname-info.plist 文件中(例如 NSLocationWhenInUseUsageDescription -> 作为密钥)

it sounds strange but it really works at least on my Xcode 6 Project. Make also sure to add the required Keys to your Projectname-info.plist file (e.g NSLocationWhenInUseUsageDescription -> as a Key)

接下来检查您的方案(产品 -> 方案 -> 编辑方案 -> 允许位置模拟)如果您使用的是 gpx 文件,您还可以将其标记为默认位置.

Next check your scheme (Product -> Scheme -> Edit Scheme -> Allow Location Simulation) If you are using a gpx file you can also mark it as a default location.

现在您可以通过按下运行按钮(播放符号)来启动您的模拟器.一旦您的应用程序开始,您将收到许可通知.

Now you can start your simulator by pressing the run button (play symbol). As soon as your application started you will get notified for the permission.

现在的最终修复是转到 iOS Simulator -> Debug -> Location 并通过从列表中选择一个自定义位置以外的位置来更改位置.稍等一下,如果它没有自行变回,则将其改回自定义位置.

The final fix now is to go to iOS Simulator -> Debug -> Location and change the location by choosing one out of the list except the custom location. Wait a little and change it back to custom location if it didnt change back by itself.

它对我有用,也希望你问候施瑞达

It worked for me, hope for you too regards Schreda

这篇关于地理定位在 iOS 8 模拟器中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Why local notification is not firing for UNCalendarNotificationTrigger(为什么没有为UNCalendarNotificationTrigger触发本地通知)
iOS VoiceOver functionality changes with Bundle Identifier(IOS画外音功能随捆绑包标识符而变化)
tabbar middle tab out of tabbar corner(选项卡栏中间的选项卡角外)
Pushing UIViewController above UITabBar(将UIView控制器推送到UITabBar上方)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Get an event when UIBarButtonItem menu is displayed(显示UIBarButtonItem菜单时获取事件)