diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2013-09-29 00:26:51 +0000 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2013-09-29 00:27:23 +0000 |
commit | 3b9d49d34b301ab57ca2de2d6971f5ca5029cc6c (patch) | |
tree | 18d12b4c88642688eada4957e26373b64cfc285f | |
parent | e0d6a30e7c0dd8c5605b0a1b7c0b28fc148dd9f7 (diff) |
iOS 7 uiduid (use MobileGestalt instead of UIKit).
-rw-r--r-- | uiduid.mm | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -41,10 +41,18 @@ #import <UIKit/UIDevice.h> #include <stdio.h> +#include <dlfcn.h> + int main(int argc, char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - printf("%s\n", [[[UIDevice currentDevice] uniqueIdentifier] UTF8String]); + NSString *udid; + if (kCFCoreFoundationVersionNumber < 800) + udid = [[UIDevice currentDevice] uniqueIdentifier]; + else + udid = [reinterpret_cast<NSString *(*)(NSString *)>(dlsym(dlopen("/usr/lib/libMobileGestalt.dylib", RTLD_GLOBAL | RTLD_LAZY), "MGCopyAnswer"))(@"UniqueDeviceID") autorelease]; + + printf("%s\n", [udid UTF8String]); [pool release]; return 0; |