Apple Watch应用程序检测苹果手表是否与手机配对 [英] Apple Watch app detect if a apple watch is paired with the phone

查看:710
本文介绍了Apple Watch应用程序检测苹果手表是否与手机配对的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户在手机上打开应用程序时,是否有方法可以检测手机是否已配对/连接到苹果手表?

When the user opens the app on the phone is there a way to detect if the phone is paired/connected to a apple watch?

推荐答案

没有内置的方法(至少在WatchKit SDK中)来确定手表是否已经与iPhone配对。一个常见的策略是将BOOL写入共享的NSUserDefaults(使用应用程序组),以便iPhone知道Watch应用程序已运行至少一次。这是我在自己的应用程序中使用的技术。

There is no built-in method (at least in the WatchKit SDK) to determine if a Watch has been paired with an iPhone. A common strategy is to write a BOOL to a shared NSUserDefaults (using app groups) so that the iPhone knows that the Watch app has been run at least once. That's the technique I've used in my own app.

这篇关于Apple Watch应用程序检测苹果手表是否与手机配对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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