0

NSImage在应用程序或 Swift Playground 中适用于所有初始化程序。但是,内部快捷方式处理程序 URL/路径初始化程序无法加载图像。initWithData作品。唯一的区别是数据由INFile. file.fileURL 不是 nil 并且具有正确的 URL。图像是什么并不重要。

- (void)resolveImageForXXX:(XXXIntent *)intent withCompletion:(void (^)(INFileResolutionResult *resolutionResult))completion
{
    INFile *file = intent.image;
    NSImage *image1 = [[NSImage alloc] initWithData:file.data];
    NSImage *image2 = [[NSImage alloc] initByReferencingURL:file.fileURL];        
    NSLog(@"%d", [image1 isValid]); //isValid 
    NSLog(@"%d", [image2 isValid]); //not valid
}
4

0 回答 0