地理位置在iOS 8模拟器中不工作 [英] Geolocation is not working in iOS 8 simulator

查看:212
本文介绍了地理位置在iOS 8模拟器中不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经升级cordova 3.5中的geolocation插件,以通过跟随此帖在iOS 8中修复此问题。



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



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



FYI:我使用Xcode 6来构建应用程序。 p>

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

解决方案

它真的工作至少在我的Xcode 6项目。确保向Projectname-info.plist文件添加所需的密钥(例如NSLocationWhenInUseUsageDescription - >作为密钥)



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



模拟器通过按下运行按钮(播放符号)。一旦您的应用程序启动,您将收到通知的权限。



现在最后的修正是去iOS模拟器 - >调试 - >位置,并通过从列表中选择一个除了自定义位置来更改位置。等一下,如果它没有改变自己的位置,改回自定义位置。



它为我工作,
希望你太
regards
Schreda


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/

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.

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

Any help/suggestion will be helpful.

解决方案

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)

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.

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模拟器中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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