以编程方式获取iphone的序列号(不是UDID) [英] Getting the serial number (not UDID) of iphone programmatically

查看:132
本文介绍了以编程方式获取iphone的序列号(不是UDID)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以告诉我获取iPhone序列号的方式(不是UDID)。

can anyone tell me the way for getting the serial number of an iPhone (not the UDID).

任何即时帮助都将受到赞赏..

any immediate help will be appreciated..

推荐答案

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

Code example (this might be outdated) using a non-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的序列号(不是UDID)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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