Jozef Dransfield
Jozef Dransfield

Reputation: 524

iOS share extensions and images in Safari

I have a share extension that is marked as supporting public.url attachments, and this works perfectly for regular web pages shared from mobile safari. However if you are viewing an image in mobile safari my share extension is not viewable even though the image is on a public url.

Does anyone know how to say you want to support anything with a public url?

Upvotes: 1

Views: 959

Answers (1)

Jozef Dransfield
Jozef Dransfield

Reputation: 524

Incase anyone has the same problem: You can change the NSExtensionActivationRule to the following:

SUBQUERY (
                extensionItems,
                $extensionItem,
                SUBQUERY (
                $extensionItem.attachments,
                $attachment,

                (
                           ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url"
                )

    ).@count == $extensionItem.attachments.@count
).@count == 1

Then you just need to iterate over the attachments until you find the one which is the public.url

Upvotes: 1

Related Questions