【发布时间】:2019-06-02 18:24:06
【问题描述】:
我正在尝试使用BOOL NSPerformService(NSString *itemName, NSPasteboard *pboard); API 以编程方式调用 Continuity Camera (Mac OS) 服务,以便可以在简单的按钮单击后挂钩该功能。需要作为itemName参数传入的Continuity Camera服务的名称是什么?
我无法从 com.apple.nsserivcescache.plist 文件中找到服务的名称,但从上下文菜单中,服务的名称是“拍照”和“扫描文档”。我不确定这些名称是否会起作用,因为它们总是与设备名称相关联( iPhone | iPad )。
我尝试过的事情。
NSPerformSerice( @"Take Photo", [NSPasteboard generalPasteboard] );
NSPerformSerice( @"<Name of the iPhone> Take Photo", [NSPasteboard generalPasteboard] );
NSPerformSerice( @"<Name of the iPhone>/Take Photo", [NSPasteboard generalPasteboard] );
【问题讨论】:
-
服务菜单项的名称是什么?
-
服务菜单项名称是
后跟两个选项“拍照”/“扫描文档”。我查看了 com.apple.nsservicescache.plist 文件以找到 Continuity Camera 功能使用的服务的名称,但找不到它的名称。 -
你尝试了哪些项目名称?
-
我尝试了以下方法,
NSPerformService( @"Take Photo", [NSPasteboard generalPasteboard] );NSPerformService( @"<Name of the iPhone> Take Photo", [NSPasteboard generalPasteboard] );``NSPerformService( @"<Name of the iPhone>/Take Photo", [NSPasteboard generalPasteboard] );但没有一个奏效。 @Willeke 指出上下文菜单方式使用连续性相机服务的链接。我想在单击按钮时执行该服务。
标签: objective-c macos cocoa appkit