Reputation: 21808
My app has an extension. This extension is available in Safari. When I use Safari share button
then it opens a share panel and my app icon is there. However if I hold down a link in Safari for a couple of seconds and the following alert pops up and I tap
Share...
button then it opens a similar share panel, I see that there are Facebook and Twitter icons but my app icon is missing. Does anybody know how to make it appear there in that share panel?
This is what opens when I tap "Share..." button:
Upvotes: 3
Views: 1450
Reputation: 21808
I've found a solution. There's key named NSExtensionActivationRule
in the plist of my extension. It belongs to NSExtensionAttributes
dictionary which in its turn belongs to NSExtension
dictionary. So the value for NSExtensionActivationRule
looks as follows for me:
<string>SUBQUERY (
extensionItems,
$extensionItem,
SUBQUERY (
$extensionItem.attachments,
$attachment,
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url" ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text"
).@count >= 1
).@count >= 1</string>
As far as I remember this is $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text"
line which does all the magic.
The complete NSExtension
dictionary looks as follows:
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationDictionaryVersion</key>
<integer>2</integer>
<key>NSExtensionActivationRule</key>
<string>SUBQUERY (
extensionItems,
$extensionItem,
SUBQUERY (
$extensionItem.attachments,
$attachment,
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url" ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text"
).@count >= 1
).@count >= 1</string>
<key>NSExtensionActivationUsesStrictMatching</key>
<integer>2</integer>
</dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.share-services</string>
</dict>
Upvotes: 2