簡體   English   中英

如何關閉WatchKit應用

[英]How to close WatchKit app

有沒有辦法關閉WatchKit應用程序?

在iOS模擬器中,有主頁按鈕(cmd + shift + h),將觸發關閉應用程序事件。 我想知道WatchKit模擬器中是否有類似的東西?

問題 -我只有一個WKInterfaceController ,但是我從沒收到過“ didDeactivate ”方法調用。

不可以,iOS Simulator當前不提供此功能。 當前的實現方式不是手表的完整模擬器,它只是WatchKit的模擬器,實現為連接到模擬iPhone的外部顯示器(而不是單獨的設備)。

您可以使用的最接近的方法是通過轉到“硬件”->“外部顯示器”菜單並選擇“已禁用”來關閉外部顯示器。

引用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