iOS8 - Simulator - How to get Locations simulated

2019-03-06 04:13发布

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

2条回答
劫难
2楼-- · 2019-03-06 04:44

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

查看更多
beautiful°
3楼-- · 2019-03-06 04:46

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.

查看更多
登录 后发表回答