문제

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.

도움이 되었습니까?

해결책 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);

다른 팁

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];
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top