防止ios模拟器询问“x想使用您当前的位置”

我们正在运行testing自动化套件,并希望在使用iOS模拟器时防止出现此消息。 任何人都可以拿出一个黑客来自动启用这个时,部署一个新的应用程序到模拟器?

不要把这个

if([CLLocationMannager isLocationServicesEnabled]) 

在你启动CLLocationManager之前检查。 这个布尔值在应用程序开始查找用户位置之前隐式调用Alert。

而且,macros –

 #if TARGET_IPHONE_SIMULATOR code..without the if([CLLocationMannager isLocationServicesEnabled]) condition //Simulator #else if([CLLocationMannager isLocationServicesEnabled]){code..} // Device #endif 

可以放在这里使用..

在你的控制台中会有一个选项不要模拟位置,看屏幕截图,你会得到一个想法 在这里输入图像说明