[ACCEPTED]-Disable location service in iPhone simulator?-core-location
You can disable the location services in 1 the simulator;
- Run your app through xcode so the simulator opens
- Stop the app via xcode (this should leave the simulator open)
- Open the Settings app in the simulator window
- Privacy > Location Services. Disable Location Services
- Run your app again, location services should be disabled
Hope it helps!
**Disregard this. This works around the 5 MapKit. Check comments below.
Disconnect 4 the computer from internet connection. How to.
EDIT: You 3 can test the code from this site that can be downloaded 2 here
With AirPort on, you get the map. With the 1 AirPort off you get a blank squared view.
To my knowledge, you can't disable the location 9 service on the simulator.
The approach that 8 I normally use when using the location service 7 is to build a simple wrapper class arround 6 NSLocation tailored to the needs of my application.
In 5 this wrapper, you could easily pretend that 4 the service is not working in the simulator. For 3 example, it could have a "isEnabled" method 2 that returns false on the simulator with 1 a compiler define like (#if TARGET_ IPHONE_SIMULATOR)
As a workaround you can try to simulate 4 update location failure by constructing 3 NSError object with appropriate values and 2 calling corresponding CLLocationManager 1 delegate didFailWithError:
method manually.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.