Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Share Extension is not working in Chrome

I am working on Share Extension

Here is code of info.plist file . this is working fine in Safari, But not in Chrome.

 <key>NSExtension</key>
        <dict>
        <key>NSExtensionAttributes</key>
        <dict>
            <key>NSExtensionActivationRule</key>
            <dict>
                <key>NSExtensionActivationSupportsImageWithMaxCount</key>
                <integer>0</integer>
                <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
                <integer>1</integer>
            </dict>
        </dict> 


        <key>NSExtensionMainStoryboard</key>
        <string>MainInterface</string>
        <key>NSExtensionPointIdentifier</key>
        <string>com.apple.share-services</string>
    </dict>

Any idea? how to enable share extension in Chrome as well

like image 668
arun kamboj Avatar asked Aug 06 '15 12:08

arun kamboj


People also ask

How do I share an extension in Chrome?

Export Chrome Extensions as CRX Files If you want to export Chrome extensions manually, you have to enable 'Developer mode' in the browser and pack the extension in a CRX file. CRX is a file that Chrome automatically downloads and installs when you add an extension.

Why can't I open an extension in Chrome?

Getting Started With Fixing Chrome Extensions To do that, navigate to More Tools > Task Manager. In the task manager, locate the extension and tap End Process. This will disable the extension from the browser. Now, go to More Tools > Extensions and give the extension a fresh start by tapping on Reload.

How do I view Chrome extension permissions?

To view the permissions of any installed extension, unpacked or from the store, open chrome://extensions page and click the details button on that extension's card. The circled part is for API permissions.


2 Answers

You are missing some code . For chrome you need to pass js file as well

<dict>
        <key>NSExtensionAttributes</key>
        <dict>
            <key>NSExtensionActivationRule</key>
            <dict>
                <key>NSExtensionActivationSupportsText</key>
                <true/>
                <key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
                <integer>1</integer>
                <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
                <integer>1</integer>
            </dict>
            <key>NSExtensionJavaScriptPreprocessingFile</key>
            <string>DemoPreprocessor</string>
        </dict>
        <key>NSExtensionMainStoryboard</key>
        <string>MainInterface</string>
        <key>NSExtensionPointIdentifier</key>
        <string>com.apple.share-services</string>
    </dict>

for more detials Please visit demo extension code from this link

like image 127
Hitu Bansal Avatar answered Oct 09 '22 09:10

Hitu Bansal


in my case, only adding the JS file with "NSExtensionJavaScriptPreprocessingFile" did not solve the problem.

<key>NSExtension</key>
    <dict>
            <key>NSExtensionAttributes</key>
            <dict>
                    <key>NSExtensionJavaScriptPreprocessingFile</key>
                    <string>Action</string>
                    <key>NSExtensionActivationRule</key>
                    <dict>
                            <key>NSExtensionActivationSupportsText</key>
                            <true/>
                            <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
                            <integer>1</integer>
                    </dict>
            </dict>
            <key>NSExtensionMainStoryboard</key>
            <string>MainInterface</string>
            <key>NSExtensionPointIdentifier</key>
            <string>com.apple.share-services</string>
    </dict>

It's also essential to add the :

<key>NSExtensionActivationSupportsText</key>
<true/>

I currently don't know why.

I've found this in the official documentation : NSExtensionActivationSupportsText : Include this key to indicate to the system and to other apps that your app supports text.

Thanks a lot.

like image 27
Amélie Medem Avatar answered Oct 09 '22 10:10

Amélie Medem