Disable location service in iPhone simulator?

I would like to check what happens if my application cannot get location coordinates. Is it possible to disable the location service in the simulator, for example, on iPod Touch with WiFI disabled?

I still do not have my certificate for iPhone developers, so I can not test it on my device.

Thanks in advance!

+6
iphone ios-simulator core-location
source share
4 answers

As a workaround, you can try to model the update location error by building an NSError object with the appropriate values ​​and calling the appropriate CLLocationManager didFailWithError: delegate method didFailWithError: manually.

0
source share

You can disable location services in the simulator;

  • Run the application through xcode to open the simulator.
  • Stop the application via xcode (this should leave the simulator open)
  • Open the Settings app in the simulator window
  • Privacy> Location Services. Disable location services.
  • Launch the application again, location services should be disabled.

Hope this helps!

+6
source share

** Do not pay attention to it. This works around MapKit. Check out the comments below.

Disconnect your computer from the Internet connection. How .

EDIT: You can test the code from this site , which can be downloaded here.

With AirPort, you get a map. With AirPort, you get an empty square.

0
source share

As far as I know, you cannot disable the location service on the simulator.

The approach that I usually use when using the location service is to create a simple arround NSLocation wrapper class adapted to the needs of my application.

In this shell, you can easily pretend that the service is not working in the simulator. For example, it may have an isEnabled method that returns false on a simulator with a compiler, for example (#if TARGET_ IPHONE_SIMULATOR)

0
source share

All Articles