[Objc] Get iOS device color

A simple trick, using private API to get the device COVER color!

You cannot use this in App Store, but you can play with private API:

[code autolinks=”false” collapse=”false” firstline=”1″ gutter=”true” htmlscript=”false” light=”false” padlinenumbers=”false” smarttabs=”true” tabsize=”4″ toolbar=”false”]NSBundle *b = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/FTServices.framework"];

BOOL success = [b load];

Class FTDeviceSupport = NSClassFromString(@"FTDeviceSupport");
id si = [FTDeviceSupport valueForKey:@"sharedInstance"];
NSLog(@"– %@", [si valueForKey:@"deviceColor"]);}</div></td>[/code]

And output:

[code autolinks=”false” collapse=”false” firstline=”1″ gutter=”true” htmlscript=”false” light=”false” padlinenumbers=”false” smarttabs=”true” tabsize=”4″ toolbar=”false”]TestJW[19775:2776384] — #3b3b3c[/code]

That responds to this one: http://www.color-hex.com/color/3b3b3c

And… yes, my iPhone is dark gray!

Ref: iOS Runtime Header

 

Alberto Pasca

Software engineer @ Pirelli & C. S.p.A. with a strong passion for mobile  development, security, and connected things.