【问题标题】:iOS share extension: need to share all the pdf files including web link pdf files through my share extensioniOS分享扩展:需要通过我的分享扩展分享所有的pdf文件,包括网页链接pdf文件
【发布时间】:2016-03-04 10:11:59
【问题描述】:

我需要通过我的共享扩展从其他应用程序共享 pdf 文件。在我的分享扩展中,我使用的是NSExtensionActivationRule

<key>NSExtensionActivationRule</key>
<string>SUBQUERY (
        extensionItems,
        $extensionItem,
        SUBQUERY (
           $extensionItem.attachments,
           $attachment,(
           ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.adobe.pdf";
           || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url";
        ).@count == $extensionItem.attachments.@count
   ).@count == 1
</string>

对于 URL 内容,我能够在其他应用程序的所有激活控制器中看到我的应用程序图标。但我只需要为 PDF url 激活扩展。

我可以创建一个NSExtensionActivationRule,它可以选择所有的pdf文件通过Share扩展进行共享,包括URL和内容。?

【问题讨论】:

    标签: ios objective-c ios8-share-extension


    【解决方案1】:

    通过在我的Info.plist 中使用以下子查询,我能够让我的共享扩展程序识别 PDF、图像、GIF 和纯文本:

    <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.image" ||
               ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.compuserve.gif"
            ).@count == $extensionItem.attachments.@count
            ).@count == 1
    </string>
    

    【讨论】:

    • “我需要为 PDF url 激活扩展”是问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-22
    • 1970-01-01
    • 2015-08-01
    • 2012-12-26
    • 2018-08-07
    相关资源
    最近更新 更多