react-native-share-menu icon indicating copy to clipboard operation
react-native-share-menu copied to clipboard

ios: Can't share a scanned pdf from the Apple Notes app

Open xavax31 opened this issue 3 years ago • 1 comments

Hi,

If i take a scan from Notes app, and want to share it from Apple Notes app, my app doesn't open. Same with the example provided in this repository. This works well for an image in a note but not for pdf.

After many searches and attempts, I created a custom ios view, and detect that the pdf file from Note app have these informations: UTI: public.file-url sharedata: {data: [{data: "....../...pdf"}], mimeType: "text/plain"}

in ShareViewController.swift.handlePost(), the public.file-url UTI send to storeFile case. By changing this code to use storeURL rather than storeFile, my app finally opens but I can't use provided url, because I get an permission error (doesn't have read permission on this file). I tried then to make a copy the file before, in tmp dir (in Share.js in the example), but this seems to create the file in a plugin context, and is not available in my app.

Has anyone ever managed to get this use case to work? Any help?

xavax31 avatar Sep 09 '22 09:09 xavax31

Use this in shareExtension, info.plist

NSExtensionAttributes NSExtensionActivationRule SUBQUERY ( extensionItems, $extensionItem, SUBQUERY ( $extensionItem.attachments, $attachment, ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.adobe.pdf" || 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 "public.pdf" ).@count == $extensionItem.attachments.@count ).@count == 1

macasfaj avatar Jun 02 '23 08:06 macasfaj