如何使用 Objective-C 从另一个应用程序获取图标?
到目前为止我已经尝试过了,但是它只是返回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);