如何检查iPhone和Apple手表是否已连接 [英] How to check whether iPhone and apple watch are connected

查看:432
本文介绍了如何检查iPhone和Apple手表是否已连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在Apple Watch中通知用户iPhone现在已经超出范围且何时回到范围内。我们怎样才能在观看分机中做到这一点。

Is there any way to notify user in Apple Watch that the iPhone is now out of range and when it comes back in range. How can we do it in watch extension.

提前致谢。

推荐答案

所以在WatchOS 2上这是可能的!

So on WatchOS 2 that is possible !

你必须在iPhone方面做:

You have to do on iPhone side :

首先:

import WatchConnectivity

然后:

   if WCSession.isSupported() { // check if the device support to handle an Apple Watch
        let session = WCSession.defaultSession()
        session.delegate = self
        session.activateSession() // activate the session

        if session.paired { // Check if the iPhone is paired with the Apple Watch
                // Do stuff
        }
    }

我希望它会帮助你:)

这篇关于如何检查iPhone和Apple手表是否已连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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