问题
We are running a test automation suite and would like to prevent this message from appearing when using the iOS Simulator. Can anyone come up with a hack to automatically enable this when deploying a new app to the simulator?
回答1:
do not put the
if([CLLocationMannager isLocationServicesEnabled])
check before u start the CLLocationManager
.
This boolean implicitly calls the Alert before the App starts finding the user location.
Also, the macros-
#if TARGET_IPHONE_SIMULATOR
code..without the if([CLLocationMannager isLocationServicesEnabled]) condition
//Simulator
#else
if([CLLocationMannager isLocationServicesEnabled]){code..}
// Device
#endif
can be put to use here..
回答2:
In your Console there will be an option Don't simulate Location, watch the screen shot , you will get an idea

来源:https://stackoverflow.com/questions/9988928/prevent-ios-simulator-from-asking-x-would-like-to-use-your-current-location