prevent ios simulator from asking “x Would like to use your current location”

痴心易碎 提交于 2019-12-13 01:41:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!