How to share only image or video with share extension

I want my extensions to support text, URLs, videos and 10 images.

I configured plist as below: enter image description here

This work is great, but I want my extension to not support image and video at the same time.

I understand that I will most likely have to build the "SUBQUERY (..)" statement. My predicate:

SUBQUERY (
extensionItems,
$extensionItem,
SUBQUERY (
$extensionItem.attachments,
$attachment,(
     NOT ( ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image"
           AND ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.movie")
     ) AND (
           ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image"
        || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text"
        || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url"
        || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.movie"
        || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.text")
).@count < 10
).@count == 1

But this does not work for me. How can I use in this case. Thanks for any help!

+5
source share
3 answers

. info.plist NSExtension. NSExtension truepredicate. plist NSExtensionActivationRule. .

enter image description here

0

, ,

   SUBQUERY (
            extensionItems,
            $extensionItem,
            SUBQUERY (
            $extensionItem.attachments,
            $attachment,
            ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.mpeg-4"
            ).@count == 0).@count == 1
            AND
            SUBQUERY (
            extensionItems,
            $extensionItem,
            SUBQUERY (
            $extensionItem.attachments,
            $attachment,
            ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image"
            ).@count &lt;= 15).@count &gt;= 1
            AND
            SUBQUERY (
            extensionItems,
            $extensionItem,
            SUBQUERY (
            $extensionItem.attachments,
            $attachment,(
               ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.adobe.pdf"
            || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.microsoft.waveform-audio"
            || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.movie"
            || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.data"
            AND NOT ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image"
            )
            ).@count &lt;= 3
            ).@count == 1
0

, . 1 , . .

SUBQUERY (
    extensionItems,
    $extensionItem,
    SUBQUERY (
        $extensionItem.attachments,
        $attachment,
        ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image" ||
        ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.movie"
    ).@count == 1
).@count == 1

:

SUBQUERY (extensionItems, $extensionItem, SUBQUERY ( $extensionItem.attachments, $attachment, ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image" || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.movie" ).@count == 1).@count == 1
0

Source: https://habr.com/ru/post/1621237/


All Articles