谁能告诉我如何获取 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/