将 Apple 的型号标识符 (MacBookPro5,1) 转换为用户友好的名称?
Mac OS X 是否具有将 Apple 的型号标识符(在 plist 和 API 中找到的类型,例如“MacBookPro5,1”)转换为这些设备的用户友好营销名称(“Unibody MacBook Pro Late 2008”)的 API?
我正在寻找比简单地硬编码更面向未来的解决方案 a列表。
Does Mac OS X have API that translates Apple's model identifiers (the kind found in plists and APIs, e.g., "MacBookPro5,1") to user-friendly marketing names of these devices ("Unibody MacBook Pro Late 2008")?
I'm looking for more future-proof solution than simply hardcoding a list.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以访问以下属性列表来获取人类友好的名称。
/System/Library/PrivateFrameworks/ServerInformation.framework/Versions/A/Resources/English.lproj/SIMachineAttributes.plist
You could access the following property list to get the human friendly name.
/System/Library/PrivateFrameworks/ServerInformation.framework/Versions/A/Resources/English.lproj/SIMachineAttributes.plist
尝试抓取此维基百科页面: http://en.wikipedia.org/wiki/Timeline_of_Apple_Macintosh_models
的当然,这并不能保证继续有效,但这是一个开始。
Try scraping this Wikipedia page: http://en.wikipedia.org/wiki/Timeline_of_Apple_Macintosh_models
Of course, this isn't guaranteed to continue to work, but it's a start.
我发现的更好的选择之一在 https://apple.stackexchange.com/questions/98080/can-a-macs-model-year-be-dependent-with-a-terminal-command。
简而言之,您可以使用硬件序列号的最后 4 个字符在 Apple 的服务器上查询计算机的营销名称。
例如
One of the better options I've found was answered at https://apple.stackexchange.com/questions/98080/can-a-macs-model-year-be-determined-with-a-terminal-command.
In short, you can query Apple's servers for the marketing name of the computer using the last 4 characters of the hardware's serial number.
For example
Apple 库中没有为此内置表格。对不起。
There's no table built into the Apple libraries for that. Sorry.