简体   繁体   English

如何关闭WatchKit应用

[英]How to close WatchKit app

Is there a way to close a WatchKit app? 有没有办法关闭WatchKit应用程序?

In iOS Simulator there is home button (cmd + shift + h) that will trigger closing app event. 在iOS模拟器中,有主页按钮(cmd + shift + h),将触发关闭应用程序事件。 I was wondering if there is something similar in WatchKit emulator? 我想知道WatchKit模拟器中是否有类似的东西?

The problem - I have one WKInterfaceController and I never receive " didDeactivate " method call. 问题 -我只有一个WKInterfaceController ,但是我从没收到过“ didDeactivate ”方法调用。

No, this functionality is not currently available in the iOS Simulator. 不可以,iOS Simulator当前不提供此功能。 The current implementation is not a full simulator of the watch, it is just a simulator for WatchKit implemented as an external display attached to the simulated iPhone (not as a separate device). 当前的实现方式不是手表的完整模拟器,它只是WatchKit的模拟器,实现为连接到模拟iPhone的外部显示器(而不是单独的设备)。

The closest thing at your disposal is to just turn off the external display by going to the Hardware -> External Displays menu and choosing "Disabled" 您可以使用的最接近的方法是通过转到“硬件”->“外部显示器”菜单并选择“已禁用”来关闭外部显示器。

Quoting from https://developer.apple.com/library/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/DesigningaWatchKitApp.html 引用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.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM