Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/extensions/Variables/includes/ExtVariables.php on line 198

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/extensions/Variables/includes/ExtVariables.php on line 198

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/extensions/Variables/includes/ExtVariables.php on line 198
libMobileGestalt.dylib - iPhone Development Wiki

libMobileGestalt.dylib

From iPhone Development Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


libMobileGestalt is a library that can be used to get various system values such as the UDID, disk usage, device version and much more. It is comparable to liblockdown.dylib. See also lockdownd.

MGCopyAnswer

// Common form: MGCopyAnswer(CFStringRef string);
CFStringRef value = MGCopyAnswer(kMGDeviceColor);
NSLog(@"Value: %@", value);
CFRelease(value);

MGGetBoolAnswer (iOS 7+)

// bool MGGetBoolAnswer(CFStringRef key);
bool value = MGGetBoolAnswer(CFSTR("UIProceduralWallpaperCapability"));
NSLog(@"Value: %d", value);

Generate Obfuscated Key

char buffer[256] = { 0 };
snprintf(buffer, sizeof(buffer), "%s%s", "MGCopyAnswer", key);

unsigned char md5Hash[CC_MD5_DIGEST_LENGTH] = { 0 };
CC_MD5(buffer, (CC_LONG)strlen(buffer), md5Hash);

NSData *data = [NSData dataWithBytes:md5Hash length:CC_MD5_DIGEST_LENGTH];
NSString *obfuscatedKey = [[data base64EncodedStringWithOptions:0] substringToIndex:22];

References

External links