Reflection on the problem: This problem still took a lot of time. My initial idea was to get NSURL from Pasteboard. NSImage can also be initialized through Pasteboard, so I wanted to get fileName from Pasteboard. Since fileName is of string type, I wanted to get NSString. Initialized through Pasteboard, but not found. From the Apple API, we can see that NSString follows the NSPasteboardWriting and NSPasteboardReading protocols, but does not provide relevant interfaces. However, a project pulled from github found that the answer to the problem is very simple. NSURL provides path to obtain the file path. The reason why the problem took so much time can only be said to be that I am not familiar with the NSURL API.
Reflection on the problem: This problem still took a lot of time. My initial idea was to get NSURL from Pasteboard. NSImage can also be initialized through Pasteboard, so I wanted to get fileName from Pasteboard. Since fileName is of string type, I wanted to get NSString. Initialized through Pasteboard, but not found. From the Apple API, we can see that NSString follows the NSPasteboardWriting and NSPasteboardReading protocols, but does not provide relevant interfaces.
However, a project pulled from github found that the answer to the problem is very simple. NSURL provides path to obtain the file path. The reason why the problem took so much time can only be said to be that I am not familiar with the NSURL API.