IOS 9 - 共享扩展必须获取public.file-url

时间:2015-10-28 05:24:35

标签: ios pdf ios9 ios8-share-extension share-extension

我在iOS9中有两种不同的情况进行共享扩展时出现问题 与iOS8一起正常工作 )---( 想要分享PDF ):

  

首先使用PDF附件邮件转发邮件应用

  1. 长按PDF附件,然后从共享表中选择我的应用程序。它是在registrationTypeIdentifiers之后给我的:
  2. registeredTypeIdentifiers: (
        "public.file-url",
        "com.adobe.pdf"
    )
    
    1. 从附件中打开PDF。它在UIDocumentInteractionController中打开PDF。 UIDocumentInteractionController提供共享功能。如果我单击共享图标,然后从共享表中选择我的应用程序。它是在registrationTypeIdentifiers之后给我的:
    2. registeredTypeIdentifiers: (
          "com.adobe.pdf"
      )
      

      我应该怎样做才能在第二个场景中获得" public.file-url"

      See the screen short of 2nd scenario

      我在plist中使用下面提到的SUBQUERY:

      SUBQUERY (
                extensionItems,
                $extensionItem,
                SUBQUERY (
                          $extensionItem.attachments,
                          $attachment,
      
                          (
            ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.file-url" 
            || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.adobe.pdf"
            || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image"
            || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.png"
            || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.jpeg"
            || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.jpeg-2000"
      
             )
      
                          ).@count == $extensionItem.attachments.@count
                ).@count == 1
      

1 个答案:

答案 0 :(得分:0)

为分享扩展制作自定义文档类型 在关键的NSExtensionActivationRule下编写谓词 例如:for pdf&我使用最大文档数量的谓词制作的图像为1。

<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
    <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.image"
                || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text"
                || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.png"
                || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.jpeg"
                || ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.jpeg-2000"
        )
        ).@count == $extensionItem.attachments.@count
        ).@count == 1</string>