如何获取 Apple Watch 硬件标识符?
How to get the Apple Watch hardware identifier?
此页面 http://theiphonewiki.com/wiki/Models 似乎暗示新苹果手表的标识符是 "Watch 1,1" 和 "Watch 1,2"
有谁知道如何在连接手表的代码中获取此标识符?
[WKInterfaceDevice currentDevice]
似乎只给我屏幕边界。
WatchKit 没有获取硬件标识符的方法。为了区分 38mm 和 42mm 手表,开发论坛中的一位 Apple 员工建议在 WKInterfaceDevice
上使用 screenBounds
属性。像这样:
if ([WKInterfaceDevice currentDevice].screenBounds.size.width == 136.0f) {
// 38mm
}
else {
// 42mm
}
此页面 http://theiphonewiki.com/wiki/Models 似乎暗示新苹果手表的标识符是 "Watch 1,1" 和 "Watch 1,2"
有谁知道如何在连接手表的代码中获取此标识符?
[WKInterfaceDevice currentDevice]
似乎只给我屏幕边界。
WatchKit 没有获取硬件标识符的方法。为了区分 38mm 和 42mm 手表,开发论坛中的一位 Apple 员工建议在 WKInterfaceDevice
上使用 screenBounds
属性。像这样:
if ([WKInterfaceDevice currentDevice].screenBounds.size.width == 136.0f) {
// 38mm
}
else {
// 42mm
}