【问题标题】:Get Mac unique identifier number (ex.: serial number) in 64-bits获取 64 位的 Mac 唯一标识符号(例如:序列号)
【发布时间】:2012-02-24 10:31:05
【问题描述】:

如何在 Cocoa 中检索 Mac 唯一标识符,例如:64 位模式下的序列号?

我关注了几篇文章,但它们是针对 32 位模式的。

谢谢

【问题讨论】:

    标签: macos cocoa macos-carbon


    【解决方案1】:

    看看这篇文章"How to get hardware and network info"

    如果您在使用 64 位架构时遇到问题 - 或者您的应用程序必须是 64 位应用程序 - 考虑将 IO 部分移至帮助实用程序并使用分布式对象访问它。

    看看Creating XPC Services

    【讨论】:

    • 我确实做到了,但正如我所提到的,它适用于 32 位应用程序。
    • 当你实现computerSerialNumber方法时编译器会说什么?我已经使用 IOKit 实现了一个苹果远程包装器,并且从未遇到 64 位问题。
    • "_IOMasterPort" (...) "_IORegistryGetRootEntry" (...) "_IORegistryEntrySearchCFProperty" (...) ld: symbol(s) not found for architecture x86_64
    • 从 CocoaDev 流出文章后,我需要将IOKit.framework 导入到我的项目中。
    【解决方案2】:

    简单的方法是执行:

    ioreg -l | grep IOPlatformSerialNumber | awk '{print $4}'

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-06-16
      • 2011-08-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-13
      • 1970-01-01
      相关资源
      最近更新 更多