Location simulation in xcode

Abhimuralidharan
3 min readMar 10, 2017

Suppose if your client is in another country and the app should use location services, then the only way is to simulate location.

Apple have given us the ability to simulate locations within our applications. This simulation works for both the device and the simulator.

For simulating location, goto your TargetEdit scheme .

Then under the Run scheme, select options tab. As you can see in the image below, the Allow location simulation checkbox should be enabled. Then you can choose a default location from the drop down.

Now, connect the device and then build and run the app (works also in simulator the same way.). Suppose if you choose Mumbai, India from the dropdown, then the app is virtually in India. The CLLocationManager will return you the location of Mumbai , India once location methods are being called.

Suppose the country that you want to simulate the location is not in the dropdown list, then you can create a ‘.gpx ‘ file (GPS Exchange Format) using some online websites and add it to Xcode (Just google how to create a gpx file.). You can see the Add GPX file to project option at the bottom of the dropdown in the…

--

--