1 #import <Foundation/Foundation.h>
2 #import <CoreGraphics/CoreGraphics.h>
4 #import <UIKit/UIKeyboard.h>
5 #import <UIKit/UIImage.h>
8 #include <mach-o/nlist.h>
11 extern "C" NSData *UIImagePNGRepresentation(UIImage *image);
13 int main(int argc, char *argv[]) {
14 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
17 memset(nl, 0, sizeof(nl));
18 nl[0].n_un.n_name = (char *) "___mappedImages";
19 nl[1].n_un.n_name = (char *) "__UISharedImageInitialize";
20 nlist("/System/Library/Frameworks/UIKit.framework/UIKit", nl);
21 NSMutableDictionary **images = (id *) nl[0].n_value;
22 void (*__UISharedImageInitialize)(bool) = (void (*)(bool)) nl[1].n_value;
24 __UISharedImageInitialize(false);
25 [UIKeyboard preheatArtwork];
27 NSArray *keys = [*images allKeys];
28 for (int i(0), e([keys count]); i != e; ++i) {
29 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
30 NSString *key = [keys objectAtIndex:i];
31 CGImageRef ref = (CGImageRef) [*images objectForKey:key];
32 UIImage *image = [UIImage imageWithCGImage:ref];
33 NSData *data = UIImagePNGRepresentation(image);
34 [data writeToFile:[NSString stringWithFormat:@"%@", key] atomically:YES];