With iOS device IOKit extensions I was able to get the serial number of the device. In iOS 7 IOKit binary is not on IOKit folder. Is there any other way to get the serial number? I want to use it on jailbroken device, Cydia can show serial number if we open it, but I didn't find other way than IOKit.
Asked
Active
Viewed 4,180 times
2 Answers
3
Cydia is open source http://gitweb.saurik.com/cydia.git . Here is how it's done in it
static NSString *UniqueIdentifier(UIDevice *device = nil) {
if (kCFCoreFoundationVersionNumber < 800) // iOS 7.x
return [device ?: [UIDevice currentDevice] uniqueIdentifier];
else
return [(id)$MGCopyAnswer(CFSTR("UniqueDeviceID")) autorelease];
}

creker
- 9,400
- 1
- 30
- 47
2
You can get it using MobileGestalt Library in your makefile
xxx_LIBRARIES = MobileGestalt
then declare:
OBJC_EXTERN CFStringRef MGCopyAnswer(CFStringRef key) WEAK_IMPORT_ATTRIBUTE;
in your Header file
then for getting the serial number you have to use :
CFStringRef SNumber = MGCopyAnswer(CFSTR("SerialNumber"));
NSLog (@"Serial Number : %@", SNumber);
if you mean UDID you have to use :
CFStringRef UDNumber = MGCopyAnswer(CFSTR("UniqueDeviceID"));
NSLog (@"UniqueDeviceID : %@", UDNumber);

iMokhles
- 219
- 2
- 9
-
Than you! I use MobileGestalt.h now, was easy to use, very simple solution! Thank you! – Robin Vekety Mar 30 '14 at 10:51