如何获取Apple Watch硬件标识符? [英] How to get the Apple Watch hardware identifier?

查看:315
本文介绍了如何获取Apple Watch硬件标识符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此页面 http://theiphonewiki.com/wiki/Models 似乎建议该标识符用于新的Apple Watch是"Watch 1,1"和"Watch 1,2"

This page http://theiphonewiki.com/wiki/Models seems to suggest that the identifiers for the new apple watches are "Watch 1,1" and "Watch 1,2"

有人知道如何在连接的手表的代码中获取此标识符吗? [WKInterfaceDevice currentDevice]似乎只给了我屏幕界限.

Does anyone know how to get this identifier in code for a connected watch? [WKInterfaceDevice currentDevice] seems to only give me the screen bounds.

推荐答案

没有WatchKit方法来获取硬件标识符.为了区分38mm和42mm手表,开发论坛中的Apple员工建议使用WKInterfaceDevice上的screenBounds属性.像这样:

There is no WatchKit method to obtain the hardware identifier. To distinguish between the 38mm and 42mm Watches, an Apple employee in the dev forums recommended using the screenBounds property on WKInterfaceDevice. Something like this:

if ([WKInterfaceDevice currentDevice].screenBounds.size.width == 136.0f) {
    // 38mm
}
else {
    // 42mm
}

这篇关于如何获取Apple Watch硬件标识符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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