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

查看:27
本文介绍了在 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 应用程序中检查该值.开发者论坛上和公开的所有迹象都表明,无法通过编程方式知道 Watch 是否已配对.

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天全站免登陆