1

从 iOS 8.1 开始,似乎无法再使用 IOKit 访问序列号:

CFTypeRef serialNumberAsCFString;
io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"));

serialNumberAsCFString = IORegistryEntryCreateCFProperty(platformExpert, CFSTR(kIOPlatformSerialNumberKey), kCFAllocatorDefault, 0);

IOObjectRelease(platformExpert);

NSString *sn = CFBridgingRelease(serialNumberAsCFString);

此时serialNumberAsCFString的 将为0x0,因此sn为空。

那么现在怎么才能找回序列号呢?或者已经不可能了?

(我完全知道 IOKit 是一个私有框架,它的使用会导致应用程序被拒绝。)

4

0 回答 0