The code below residing in my MacBook should work to discover the serial number of my IPad connected to my MacBook's USB port with the 32 pin connector to USB cable. Now I have an urgent need to write some code residing IN MY IPad to discover its own serial number.
Any suggestions?
Code:
- (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;
}
Any suggestions?
Last edited: