tags:

views:

115

answers:

2

Hi friends.

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

any immediate help will be appreciated..

+1  A: 

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;
}
The MYYN
I'd note here that it uses IOKit, which is not public, so using it in your app will get it rejected from the AppStore
unbeli
thanks a lot for your suggestion unbeli...
thank you Roque... your comments were very helpful... My idea was to use serial number(short and convenient) instead of UDID(lengthy) of iPhone in my app ..But i have no choices left
A: 

Ready to use category on UIDevice: UIDevice+serialNumber. Not sure this would be accepted on the App Store.

0xced