iphone - 以编程方式获取 iPhone 的序列号(不是 UDID)

标签 iphone

谁能告诉我如何获取 iPhone 的序列号(不是 UDID)。

任何立即帮助将不胜感激..

最佳答案

使用非公共(public) API 的代码示例(这可能已经过时):

http://www.iphonedevforums.com/forum/sdk-coding-help/145-unique-identifier-iphone.html

@implementation AppLib
...

- (NSString*)getSerialNumber
{
    CFTypeRef serialNumberAsCFString;
    io_service_t platformExpert = IOServiceGetMatchingService(
        kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
    if (platformExpert)
        {
            serialNumberAsCFString = IORegistryEntryCreateCFProperty(
                platformExpert, CFSTR(kIOPlatformSerialNumberKey), 
                kCFAllocatorDefault, 0);
        }
    IOObjectRelease(platformExpert);
    NSString *serial = 
        [[NSString alloc] initWithFormat:@"%@",serialNumberAsCFString];
    return serial;
}

关于iphone - 以编程方式获取 iPhone 的序列号(不是 UDID),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3132619/

相关文章:

iphone - 创建条件转场

iphone - 使用移动 CSS 改造现有网页

javascript - PWA 无法在 iPhone/iPad 上以全屏模式打开

iPhone开发-内存释放问题

iphone - 初学者 iOS 游戏开发 iPhone/iPad 的指南和教程?

iphone - UIPickerView 去除渐变边框

iphone - 在 iPhone 上使用 OpenGL ES 卷积图像 : possible?

iphone - 极其奇怪的 iTunesConnect 错误——缺少屏幕截图?

iphone - 导航栏中的信息灯按钮

php - 带有 JSON、PHP 的 iOS