在iOS 8中检测Apple Watch [英] Detecting Apple Watch in iOS 8

查看:125
本文介绍了在iOS 8中检测Apple Watch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些仅在用户使用Apple Watch时才应触发的事件.有没有一种方法可以检测手表是否配对?我不确定是否可以使用共享的应用程序组来检测Apple Watch扩展,或者是否可以使用蓝牙?

I have some events that should only be fired off if a user has an Apple Watch. Is there a way to detect whether a watch is paired? I'm not sure if I can use the shared app group to detect the Apple Watch extension or maybe I can use bluetooth?

推荐答案

最好的做法是,在首次运行Watch应用程序时,在共享NSUserDefaults中将BOOL设置为true,然后在iOS应用程序中检查该值.开发人员论坛上和公开场合的所有迹象都表明,无法以编程方式知道手表是否已配对.

The best you an do is set a BOOL to true in shared NSUserDefaults the first time the Watch app is run and then check for that value in your iOS app. All indications on the dev forums and publicly have been that there isn't a way to programatically know if a Watch has been paired.

这篇关于在iOS 8中检测Apple Watch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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