我正在尝试DnD一个承诺的文件。在方法中:
- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index
当我看到我的pboard属于NSFilesPromisePboardType
类型时,我会这样做:
NSArray *filenames = [info namesOfPromisedFilesDroppedAtDestination:[NSURL fileURLWithPath:path]]
(info
当然是NSDraggingInfo
。
当我从Outlook for Mac等应用程序拖动多个文件时,namesOfPromisedFilesDroppedAtDestination
的行为符合预期,“filenames”数组保留尽可能多的项目。
但是,当我从Chrome中拖动项目时(例如,Gmail附件,可能) - 我看到pboard.pasteboardItems
确实包含了所有附件,但是namesOfPromisedFilesDroppedAtDestination
只返回一个项目!
有关如何解决这个问题的想法吗?
万分感谢,
尼里
答案 0 :(得分:0)
该方法的实现取决于'source',并且它似乎不允许将多个附件写入磁盘 - 即使您可以拖动它们。这是独立的
答案 1 :(得分:0)
为什么使用promises而不是普通文件?我建议转储你的来源提供的类型,可能有一个更合适。