如何检测手表操作系统是否关闭了 ios 应用程序 SWIFTUI [英] How can detect watch os is ios app closed SWIFTUI

查看:26
本文介绍了如何检测手表操作系统是否关闭了 ios 应用程序 SWIFTUI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 iOS 应用程序关闭时使用 watch os 进行检测?我使用 swift 和 watchConnectivity.

How can I detect with watch os when iOS app is closed? I use swift and watchConnectivity.

我也使用 swiftUI

Also I use swiftUI

推荐答案

如果您使用的是 SwiftUI

If you are using SwiftUI

SceneDelegate.swift :

SceneDelegate.swift :

func sceneDidDisconnect(_ scene: UIScene) {
    sendMessageToWatch()
 }

这篇关于如何检测手表操作系统是否关闭了 ios 应用程序 SWIFTUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆