在macOS中获取用户首选的温度设置 [英] Get user preferred temperature setting in macOS

查看:87
本文介绍了在macOS中获取用户首选的温度设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试读取温度单位(摄氏度/华氏度)的用户设置系统偏好设置.我试图使用NSLocale来获取此数据,但在那里找不到任何温度设置的证据.

I'm trying to read the user set system preferences for Temperature unit (Celsius/Fahrenheit). I was trying to get this data using NSLocale but I cannot find any evidence of a temperature setting in there.

是否有可能读取此数据?

Is it even possible to read this data?

谢谢!

推荐答案

官方API记录在

如果您想知道我是怎么找到它的,我在终端中使用了 defaults 实用程序:

If you wonder how I found it, I used the defaults utility in the Terminal:

> defaults find temperature
Found 1 keys in domain 'Apple Global Domain': {
    AppleTemperatureUnit = Fahrenheit;
}
Found 1 keys in domain 'com.apple.ncplugin.weather': {
    WPUseMetricTemperatureUnits = 1;
}

这篇关于在macOS中获取用户首选的温度设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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