Detecting Apple Watch in iOS 8

家住魔仙堡 提交于 2019-12-20 02:55:08

问题


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?


回答1:


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.




回答2:


This is possible on watchOS2.0+

I tried to give an answer here https://stackoverflow.com/a/44190804/2946782

you can check if connectivity session is supported as described here: How to check whether iPhone and apple watch are connected



来源:https://stackoverflow.com/questions/29681458/detecting-apple-watch-in-ios-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!