2

My Share extension should accept a maximum of 4 items, images and videos combined. The extension should not accept other file types like PDFs.

So far this is my activation rule query.

    <key>NSExtensionAttributes</key>
    <dict>
        <key>NSExtensionActivationRule</key>
        <string>
            SUBQUERY (
                extensionItems,
                $extensionItem,
                SUBQUERY(
                    $extensionItem.attachments,
                    $attachment,
                    ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.movie"
                ).@count &lt;= 2
                AND
                SUBQUERY(
                    $extensionItem.attachments,
                    $attachment,
                    ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image"
                ).@count &lt;= 2
            ).@count &gt;= 1
        </string>
    </dict>

It works for accepting a maximum of 4 items, images and videos combined. But I cannot figure out how to exclude other file types so that my app extension is not invoked e.g. when trying to share a PDF from the Files app.

Samuël
  • 1,147
  • 1
  • 10
  • 17

0 Answers0