0

I am having issues with getting my share extension to show up in Google Chrome. It shows up and works great in Safari, but does not show up in Chrome. I am using the following activation rule and it's also working in other apps (images, pdf, sharing text), but it is missing from chrome.

From my info.plist:

<dict>
    <key>NSExtensionAttributes</key>
    <dict>
        <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" ||
                ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.text" ||
                ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.jpeg" ||
                ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.png"  ||
                ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image" ||
                ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.adobe.pdf"
            ).@count == 1
        ).@count == 1
        </string>
        <key>NSExtensionJavaScriptPreprocessingFile</key>
        <string>GetURL</string>
    </dict>
    <key>NSExtensionPointIdentifier</key>
    <string>com.apple.share-services</string>
    <key>NSExtensionMainStoryboard</key>
    <string>MainInterface</string>
</dict>

Any ideas?

Josh Lee
  • 171,072
  • 38
  • 269
  • 275
tcj123
  • 167
  • 1
  • 2
  • 10

1 Answers1

2

For your question about not see your own App shareExtension in Chrome, the reason that you can not see your shareExtension in Chrome normally is your NSExtensionActivationRule not matching the Chrome. The answer for this issue is related to the Key (NSExtensionActivationSupportsAttachmentsWithMaxCount). :P

I show you my plist, and it is working well in Chrome and Safari.

    <key>NSExtensionActivationRule</key>
    <dict>
        <key>NSExtensionActivationSupportsAttachmentsWithMaxCount</key>
        <integer>2</integer>
        <key>NSExtensionActivationSupportsImageWithMaxCount</key>
        <integer>0</integer>
        <key>NSExtensionActivationSupportsMovieWithMaxCount</key>
        <integer>0</integer>
        <key>NSExtensionActivationSupportsText</key>
        <true/>
        <key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
        <integer>1</integer>
        <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
        <integer>1</integer>
    </dict>

All you need to do is change the value of Key - NSExtensionActivationSupportsAttachmentsWithMaxCount to a number > 1, I think the reason is Chrome pass its data to the extensionContext!.inputItems[1] rather than extensionContext!.inputItems[0], you can try set different value of this Key by yourself.

Hope this can help you out :)

MnS
  • 101
  • 4
  • Hi i also want to add share extension for crome for autofill password in native apps like 1Password and Dashlane app does How can i start work with this can you please give me some basic idea regarding that. Need help. – Anita Nagori Jan 18 '18 at 08:24