【问题标题】:prevent ios simulator from asking "x Would like to use your current location"防止 ios 模拟器询问“x 想使用您当前的位置”
【发布时间】:2012-04-03 07:30:41
【问题描述】:

我们正在运行一个测试自动化套件,并希望防止在使用 iOS 模拟器时出现此消息。任何人都可以想出一个技巧来在将新应用部署到模拟器时自动启用此功能吗?

【问题讨论】:

    标签: iphone ios ios-simulator core-location


    【解决方案1】:

    不要放

     if([CLLocationMannager isLocationServicesEnabled])
    

    在您启动CLLocationManager 之前检查。 此布尔值在 App 开始查找用户位置之前隐式调用 Alert。

    还有,宏-

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

    可以在这里使用..

    【讨论】:

      【解决方案2】:

      在你的控制台中会有一个选项不要模拟位置,看屏幕截图,你会明白的

      【讨论】:

        猜你喜欢
        • 2021-08-21
        • 2022-01-15
        • 2017-06-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-11-08
        相关资源
        最近更新 更多