Macos 如何仅为.zip文件提供上下文菜单项?

Macos 如何仅为.zip文件提供上下文菜单项?,macos,object,cocoa,unzip,findersync,Macos,Object,Cocoa,Unzip,Findersync,我正在cocoa中开发zip提取器应用程序,使用findersync显示上下文菜单项。但是,问题是我只想为.zip文件显示的每个文件都显示了项,所以我该怎么做呢 任何建议 提前谢谢 考虑添加一个。这将允许您为任何文件添加项目,而不仅仅是受监控文件夹中的文件。服务的plist条目允许您直接指定可接受的文件类型,即将服务限制为ZIP文件 NSURL *selectedURL = FIFinderSyncController.defaultController.selectedItemURLs[0];

我正在cocoa中开发zip提取器应用程序,使用findersync显示上下文菜单项。但是,问题是我只想为.zip文件显示的每个文件都显示了项,所以我该怎么做呢

任何建议

提前谢谢

考虑添加一个。这将允许您为任何文件添加项目,而不仅仅是受监控文件夹中的文件。服务的plist条目允许您直接指定可接受的文件类型,即将服务限制为ZIP文件

NSURL *selectedURL = FIFinderSyncController.defaultController.selectedItemURLs[0];
NSURL *fileURL = selectedURL.filePathURL;
if([fileURL.pathExtension isEqualToString:@"zip"]) {
  NSMenu *menu = [[NSMenu alloc] initWithTitle:@""];
  NSMenuItem *item = [menu addItemWithTitle:@"Hello" action:@selector(itemTarget:) keyEquivalent:@""];
  item.target = self;        
  return menu;
}
你能帮我解决这个问题吗