iOS 11 PDF共享扩展

And*_*obs 5 pdf ios share-extension ios11

我有以下规则集

<dict>
            <key>NSExtensionActivationRule</key>
            <string>
                SUBQUERY (
                extensionItems,
                $extensionItem,
                SUBQUERY (
                $extensionItem.attachments,
                $attachment,
                ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.adobe.pdf" OR
                ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.file-url" OR
                ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text" OR
                ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.text" OR
                ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "pdf" OR
                ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.pdf" OR
                ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url"
                ).@count == $extensionItem.attachments.@count
                ).@count == 1
            </string>
            <key>NSExtensionJavaScriptPreprocessingFile</key>
            <string>JavascriptPreprocessor</string>
        </dict>
Run Code Online (Sandbox Code Playgroud)

当我去Safari浏览器时,在iOS 10中,我看到我在iOS 11上的共享扩展程序,我看不到它.是否有一个额外的uti-conforms-to我需要添加到它能够在任何人都知道的iOS 11上工作?

Rub*_*zzi 4

我遇到了完全相同的问题,并且我注意到某些 UTI(例如 public.url)禁用了 pdf UTI。如果删除它们,则从网页加载 pdf 时会显示扩展名。换句话说,似乎包含其中一个会禁用另一个。我的解决方案是手动查找适用于 pdf 和网页的 UTI。如果 pdf 来自网页,则此配置应该适用于 iOS 11.0 及之前的版本(至少在使用 xcode9 的模拟器中有效)。

SUBQUERY (
            extensionItems,
            $extensionItem,
            SUBQUERY (
            $extensionItem.attachments,
            $attachment,
            (
            ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url"
            || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.text";
            )
            ).@count == $extensionItem.attachments.@count
            ).@count == 1
Run Code Online (Sandbox Code Playgroud)

更新:我已经添加了

|| ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.text"
Run Code Online (Sandbox Code Playgroud)

允许 Chrome 和 Firefox 在 html 和 pdf 文档中看到该扩展。