Vam*_*hna 15 ios apple-watch watchkit
在我的应用中,
我需要找到我的手机是否与苹果手表配对,并获得有关配对手表的一些信息,如名称.我试过阅读文档,但我似乎找不到任何特定于我的用例的东西.
任何帮助表示赞赏.
Bil*_*fas 15
所以从WatchOS 2开始就有可能!
你必须在iPhone方面做:
第一:
import WatchConnectivity
Run Code Online (Sandbox Code Playgroud)
然后 :
if WCSession.isSupported() { // check if the device support to handle an Apple Watch
let session = WCSession.default()
session.delegate = self
session.activate() // activate the session
if session.isPaired { // Check if the iPhone is paired with the Apple Watch
// Do stuff
}
}
Run Code Online (Sandbox Code Playgroud)
我希望它会帮助你:)
| 归档时间: |
|
| 查看次数: |
4415 次 |
| 最近记录: |