选择了相同类型的多个动作时扩展激活规则谓词不隐藏行动 [英] Action Extension activation rule predicate doesn't hide the action when multiple of the same type is selected

查看:85
本文介绍了选择了相同类型的多个动作时扩展激活规则谓词不隐藏行动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在尝试进行操作扩展,使其仅适用于单个GIF文件.这是我的代码(使用Apple文档中提供的代码段创建:

SUBQUERY (
    extensionItems,
    $extensionItem,
    SUBQUERY (
        $extensionItem.attachments,
        $attachment,
        ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.compuserve.gif"
    ).@count == $extensionItem.attachments.@count
).@count == 1

该扩展程序应该可以在Photos应用程序中使用,并且我已经尝试了多种方案:单个GIF文件,单个非GIF文件,多个非GIF文件,GIF和非GIF文件的混合以及多个GIF文件./p>

以上所有方案均适用,但多个GIF文件除外-如果我选择了多个项目,则该操作会重新出现.

我希望仅在使用单个GIF时显示操作.上面的谓词我在做什么?

解决方案

从调试代码开始,似乎它是带有一堆附件的单个扩展项.因此,仅支持单个附件,您需要执行以下操作:

将$ extensionItem.attachments.@ count替换为1.

如果您选择了1个以上的GIF文件,这应该隐藏您的扩展名.

Hello I am trying to make action extension to only work with a single GIF file. Here is my code (created using the snippet provided in Apple's documentation:

SUBQUERY (
    extensionItems,
    $extensionItem,
    SUBQUERY (
        $extensionItem.attachments,
        $attachment,
        ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.compuserve.gif"
    ).@count == $extensionItem.attachments.@count
).@count == 1

This extension is supposed to work inside Photos app and I have tried multiple scenarios: Single GIF file, Single Non-GIF file, Multiple Non-GIF files, Mix of GIF and Non-GIF files, and Multiple GIF files.

All the above scenarios work except for Multiple GIF files - if I select multiple items, the action reappears.

I want the action to only appear when I am using single GIF. What am I doing wrong with the predicate above?

解决方案

From debugging the code, it seems like it is a single extension item with a bunch of attachments. So to support only a single attachment you would to do the following:

Replace $extensionItem.attachments.@count with 1.

This should hide your extension if you are selecting more than 1 GIF file.

这篇关于选择了相同类型的多个动作时扩展激活规则谓词不隐藏行动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆