How do I get the icon from another application using Objective-C?
I have tried this so far, however it just returns null:
NSURL *path = [NSURL URLWithString:@"/Applications/Calculator.app"];
NSLog(@"%@", path);
NSImage *image = (__bridge NSImage *)(QLThumbnailImageCreate(kCFAllocatorDefault, (__bridge CFURLRef)(path), CGSizeMake(100, 100), (__bridge CFDictionaryRef)(@{(NSString *)kQLThumbnailOptionIconModeKey: @NO})));
NSLog(@"%@", image);
You can use NSWorkspace, e.g.
If you want to use the app
bundleIdinstead of knowing its path, you can do this first