共享扩展谷歌浏览器 - 不起作用



我在让共享扩展显示在谷歌浏览器中时遇到了问题。它在Safari中显示并运行良好,但在Chrome中没有显示。我正在使用以下激活规则,它也可以在其他应用程序(图像、pdf、共享文本(中使用,但 chrome 中缺少它。

从我的信息列表:

<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>

有什么想法吗?

对于您在 Chrome 中看不到自己的 App shareExtension 的问题,您无法在 Chrome 中正常看到您的 shareExtension 的原因是您的 NSExtensionActivationRule 与 Chrome 不匹配。這個問題的答案與 Key (NSExtensionActivationSupportsAttachmentsWithMaxCount( 有關。:P

我向你展示我的plist,它在Chrome和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>

您需要做的就是将 Key - NSExtensionActivationSupportsAttachmentsWithMaxCount 的值更改为 1>,我认为原因是 Chrome 将其数据传递给扩展上下文!inputItems[1] 而不是 extensionContext!。inputItems[0],您可以尝试自己设置此键的不同值。

希望这可以帮助您:)

最新更新