如何关闭WatchKit应用程序

时间:2014-12-13 20:17:52

标签: ios ios-simulator watchkit

有没有办法关闭WatchKit应用?

在iOS模拟器中,有一个主页按钮(cmd + shift + h)将触发关闭应用程序事件。我想知道WatchKit模拟器中是否有类似内容?

问题 - 我有一个WKInterfaceController而我从未收到" didDeactivate"方法调用。

2 个答案:

答案 0 :(得分:3)

不,此功能目前在iOS模拟器中不可用。目前的实现并不是手表的完整模拟器,它只是WatchKit的模拟器,实现为连接到模拟iPhone的外部显示器(而不是单独的设备)。

您最接近的是通过转到硬件关闭外部显示器 - >外部显示菜单并选择"已禁用"

答案 1 :(得分:2)

引自https://developer.apple.com/library/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/DesigningaWatchKitApp.html

During testing, you can lock and unlock the simulator to verify that your
activation and deactivation code is working as expected. 
When you use the Hardware > Lock command to lock the simulator, 
WatchKit calls the didDeactivate method of the current interface controller. 
When you subsequently unlock the simulator, 
WatchKit calls the willActivate method of the interface controller.