Get icon for another application in Objective-C

前端 未结 3 836
我在风中等你
我在风中等你 2021-02-08 17:00

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 = [NSU         


        
3条回答
  •  生来不讨喜
    2021-02-08 17:55

    I think you're looking for [[NSWorkspace sharedWorkspace] iconForFile:pathToFile]

    https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWorkspace_Class/Reference/Reference.html#//apple_ref/doc/uid/20000391-iconForFile_

提交回复
热议问题