How do you get the serial number of a device in iOS 8?

The below method uses IOKit to get the serial number of the device, but now as of iOS 8, it causes the app to crash. Does anyone know about this? I have a large number of public domain devices with enterprise apps that are not meant to represent an app store, and they use a serial number to uniquely identify the device.

CFTypeRef platformSerialNumber = IORegistryEntryCreateCFProperty(platformExpertDevice, CFSTR("IOPlatformSerialNumber"), kCFAllocatorDefault, 0);
if (CFGetTypeID(platformSerialNumber) == CFStringGetTypeID())
     serialNumber = [NSString stringWithString:(__bridge NSString*)platformSerialNumber];


It crashes on CFGetTypeID with EXC_BAD_ACCESS.

Console logs: * - [NSKeyedUnarchiver initForReadingWithData:]: NULL data


source to share

1 answer

Failed because platformSerialNumber is zero.

Starting with iOS 8 Beta 5, the IOPlatformSerialNumber property was removed and a call to retrieve its value now returns nil.



All Articles