我想确保当 Watch 未与 iPhone 配对时,用户会收到正确信息的警告。我看到当我关闭蓝牙时,一些其他应用程序显示全屏红色设备图标,应用程序名称为白色,表示设备未配对,应用程序需要配对才能工作。当我使用我的应用程序做同样的事情时,没有任何反应,我仍然只在右(或左,取决于手腕......)角落的时间旁边得到一个小图标,而不是全屏图标。
我想知道是否有一种特定的方法可以向用户显示该状态,或者它是否应该是由系统处理的自动功能,但由于某些原因,它对我不起作用。
最佳答案
不知道自动功能,但使用 WatchConnectivity
框架你可以知道 paired
iPhone
是否可达。如果没有,您可以显示一个 interface controller
并带有适当的消息来警告用户。 WCSession
有一个 bool 属性 reachable
其描述如下。
讨论
In your WatchKit extension, the value of this property is YES when a matching session is active on the user’s iPhone and the device is within range so that communication may occur. On iOS, the value is YES when the paired Apple Watch is in range and the associated Watch app is running in the foreground. In all other cases, the value is NO.
更多详情请查看WatchConnectivity Framwork
关于ios - "devices not paired"的 WatchKit 事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34529302/