iOS8 - Simulator - How to get Locations simulated

让人想犯罪 __ 提交于 2019-12-02 17:07:10

问题


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];

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!!!


回答1:


In the iOS Simulator, select Debug > Location, then choose your location.




回答2:


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.



来源:https://stackoverflow.com/questions/26151047/ios8-simulator-how-to-get-locations-simulated

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