【问题标题】:iOS Simulator custom City Run outside XcodeiOS Simulator 自定义 City Run 在 Xcode 之外
【发布时间】:2021-05-03 14:51:02
【问题描述】:

我目前正在使用 VSCode 和 Xcode iOS-Simulator 开发 Flutter 应用程序。

在开发过程中,我想使用自定义位置而不是预加载的 iOS 城市运行位置来模拟“城市运行”。

我能够将自定义城市 Run 添加到 Xcode-Project(使用 .gpx 文件),但只能在调试 Xcode-Project 时使用它。

现在,我想不出一种方法来更改或更新一个项目中的 City-Run 位置,而不是在 Xcode 中运行,而是在 VSCode 中运行。

你们中是否有人知道如何:

  • 在不使用 Xcode 项目的情况下将位置添加到 iOS 模拟器
  • 使用 Xcode 将位置添加到模拟器以永久使用模拟器中的位置(不仅在 Xcode 中调试时)
  • 更新 iOS 模拟器使用的 City Run 的默认位置

我目前正在跑步:

  • Mac OS 11.1(大苏尔)
  • MacBook Pro(13 英寸,M1,2020 年)
  • 颤振 1.22.6
  • 模拟器:iPhone 12 Pro Max - iOS 14.3

非常感谢你们!任何帮助将不胜感激!????

干杯, 托比

【问题讨论】:

    标签: ios xcode flutter ios-simulator


    【解决方案1】:

    现在我找到了可能不是很漂亮的解决方法,但它对我有用。

    我跟着this article 写了一个小AppleScript 来定期更新当前位置并模拟“City Run”。

    虽然它有几个缺点(例如模拟器必须是最前面的进程),但它在开发过程中为我完成了模拟 City Run 的工作。

    不过,如果有人提出更好的解决方案,请告诉我。

    这就是脚本现在的样子:

    on run
        tell application "System Events"
            tell process "Simulator"
                set frontmost to true
                click menu item "Custom Location…" of menu of menu item "Location" of menu "Features" of menu bar 1
                set popup to window "Custom Location"
                set value of text field 1 of popup to "<lat here>"
                set value of text field 2 of popup to "<long here>"
                click button "OK" of popup
                delay 2
                -- (Further locations here)
            end tell
        end tell
    end run
    

    干杯,

    托比

    【讨论】:

      猜你喜欢
      • 2019-02-25
      • 1970-01-01
      • 1970-01-01
      • 2022-06-14
      • 1970-01-01
      • 2016-05-04
      • 2013-05-26
      • 2015-05-12
      • 1970-01-01
      相关资源
      最近更新 更多