Evaluating URL using predicate? (Share Extension)

I use the predicate below as NSExtensionActivationRule for my Share Extension. It shows my extension in the share sheet if the host app provides a public.url OR plain.text.


My question: is there a way to evaluate the URL to decide if my extension should be visible in the share sheet? For example, I would only like to show it if the url matches "https://mydomain.com". I don't think this can be done, but want to be sure.


SUBQUERY (

extensionItems,

$extensionItem,

SUBQUERY (

$extensionItem.attachments,

$attachment,

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

).@count == 1

).@count == 1

||

SUBQUERY (

extensionItems,

$extensionItem,

SUBQUERY (

$extensionItem.attachments,

$attachment,

ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text"

).@count == 1

).@count == 1

it should be possible by testing $attachment with an AND condition against your pattern.


You should be able to use any of ==, LIKE or MATCHES in the test.

The rest is left for you to work out. Maybe you could write a small test app to create and run some predicates to see how this would work?


https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/Predicates/Articles/pSyntax.html

I have the same question. Did ya ever find an answer?

8 Years later this has not been solved right? I'm also currently looking at this issue and can't figure out how to evaluate the incoming attachments value. Any progress here?

Evaluating URL using predicate? (Share Extension)
 
 
Q