I am using a Custom Location under Debug --> Location --> Custom Location
While this setting does work just fine for me, the simulator frequently changes my setting from Custom Location to None. This reverting does not appear to have a pattern as I may run the same project 5 or 10 times without the setting reverting. Other times it changes the Location to None every 1 or 2 times I run the simulator.
Is there a way to lock the setting in so I do not have to fight with it?
in iOS Simulator menu, go to Features -> Location -> Custom Location. There you can set the latitude and longitude and test the app accordingly. This works with mapkit and also with CLLocationManager.
Setting location in the simulator: Once you have your app running in the simulator, navigate to Debug→Location in the menu.
If you're making a route, tap-and-hold on the map to drop place markers. Use the play button on the bottom corner of the map to enable the fake GPS setting.
Have you tried setting a default location? May be it is set to none.
Edit your scheme > Select "Run XXXX.app / Debug" > Select "Allow Location Simulation" and select a default location.
The accepted answer it is a solution, solved your problem, but for other developers that are facing this issue, there is also a easier solution where you don't need a GPX file or to select one of the locations provided as default:
Now the simulator will keep this as default location. Actually the Allow Location Simulation on Xcode, together with the option none is the reason for "forgetting" the location you added before.
From now on, your simulator will always remember the last custom location!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With