问题描述
我的应用程序跟踪您的位置。
使用iOS8,我不得不改变它启动位置服务的方式。
我使用了
My App tracks your location.With iOS8 I had to change how it was starting location services.I got this working with
[self.locationManager requestAlwaysAuthorization];
并将NSLocationAlwaysUsageDescription添加到plist文件中。
and adding NSLocationAlwaysUsageDescription to the plist file.
应用程序现在可以在设备上运行时获取您的位置,但不会在模拟器中运行。
The app now gets your location when run on a device, but not in the simulator.
有关如何在模拟器中使用此功能的任何线索?它曾经!!!!
Any clues on how to get this to work in the simulator? It used to!!!
推荐答案
我决定发布这个以防其他人有同样的问题。我让模拟器通过将NSLocationWhenInUseUsageDescription添加回plist文件来再次响应位置更改。我删除了它,因为我的应用程序需要Always权限而不是WhenInUse。通过将此添加回到plist,模拟器现在很高兴。我在物理设备上没有这个问题,只有模拟器。
I decided to post this in case anyone else had the same issue. I got the simulator to respond to location changes again by adding NSLocationWhenInUseUsageDescription back into the plist file. I had removed it since my app needs the Always permission instead of WhenInUse. By adding this back to the plist the simulator is now happy. I did not have this issue on the physical device, just the simulator.
这篇关于iOS8 - 模拟器 - 如何获取模拟的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!