如何在iOS模拟器中禁用系统位置警报 [英] How to disable system location alert in iOS simulator

查看:104
本文介绍了如何在iOS模拟器中禁用系统位置警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用KIF框架( http://github.com/kif-framework/KIF ),并使用Xcode Continuous Integration Server进行UI测试。

I use KIF framework (http://github.com/kif-framework/KIF) with Xcode Continuous Integration Server for UI testing.

当iOS Simulator系统中的XCode CI服务器启动应用程序时,会出现应用程序想要使用您当前的位置警报。

When XCode CI server start app in iOS Simulator system alert "Application would like to use your current location" appears.

我使用此委托人

- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus: (CLAuthorizationStatus)status

以获得用户允许使用位置和我需要它保持原样。

to get the notification that user allows to use location and I need it to keep like it is.


  1. 是否可以使用KIF在此系统警报上点击确定?我没有找到方法。

  2. 或者如何在不显示此警报的情况下允许应用程序在模拟器中使用位置服务?


推荐答案

根据此从最重要的KIF贡献者那里得到答案,不可能自动解除系统警报,因此,您应该模拟(即替代)定位服务,以便您可以测试代码而不会遇到警报。

According to this answer from the top KIF contributor, dismissing system alerts automatically is impossible, and you should therefore mock (i.e. provide a substitute for) the location service so that you can test your code without running into the alert.

这篇关于如何在iOS模拟器中禁用系统位置警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆