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