3

I have an issue in share extension with 2 different scenario in iOS9 (working fine with iOS8) --- (wants to share PDF):

First goto the mail app with PDF attachment mail-

  1. Long press the PDF attachment then select my application from share sheet. It was given me following registeredTypeIdentifiers :
registeredTypeIdentifiers: (
    "public.file-url",
    "com.adobe.pdf"
)
  1. Open the PDF from attachment. It was open PDF in UIDocumentInteractionController. UIDocumentInteractionController gives sharing facilities. If i click on the share icon then select my application from share sheet. It was given me following registeredTypeIdentifiers :
registeredTypeIdentifiers: (
    "com.adobe.pdf"
)

What should i do to get "public.file-url" in the 2nd Scenario.

See the screen short of 2nd scenario

I am using below mention SUBQUERY in plist :

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
Akshar Darji
  • 397
  • 2
  • 12

1 Answers1

2

to make customize document type for share extension write predicates under key NSExtensionActivationRule for example:for pdf & image i made following predicates with maximum amount of document to 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>
Rudra
  • 241
  • 1
  • 3
  • 9