调试时如何只重启 Apple Watch 应用程序?

How to restart only Apple Watch app when debugging?

我正在尝试使用 Apple Watch 模拟器进行调试。当我启动应用程序时它工作正常 -- awakeWithContext() 运行并正常工作,除了还没有数据。

我需要在用户导航到 iOS 应用程序中的特定位置后测试 testawakeWithContext()(因为要获取更多数据)。

有没有办法在不重启模拟器中的iOS应用的情况下重启Apple Watch应用?我想到的唯一替代方法是在将调用 awakeWithContext() 的 Watch 应用程序上放置一个临时按钮。谢谢!

您可以从终端终止手表应用的 运行 进程,然后重新启动它。

kill -9 <pid of your watch app>
xcrun simctl launch booted <identifier of your watch app>