Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF Documents #104

Open
sc-keyzo opened this issue Jun 16, 2020 · 7 comments
Open

PDF Documents #104

sc-keyzo opened this issue Jun 16, 2020 · 7 comments

Comments

@sc-keyzo
Copy link

Hi

i'm trying to use your plugin to receive PDF documents from other iPad apps but not having any success. This is the command i use to enable the plugin:

cordova plugin add cc.fovea.cordova.openwith --variable IOS_URL_SCHEME=keyzoopenwith --variable IOS_UNIFORM_TYPE_IDENTIFIER=com.adobe.pdf

The cordova app compiles ok and runs on my iPad however, the app does not show up in the "Copy to" form of any other apps that handle PDF document.

If i reconfigure the plugin to look for public.image, the same as the example you provide, then all works ok.

Am i missing a configuration step somewhere or is this a bug?

thanks

@perelin
Copy link

perelin commented Jun 28, 2020

Hi, same issue. @sc-keyzo did you made any progress?

@axel012
Copy link

axel012 commented Jul 1, 2020

@perelin @sc-keyzo
I made this changes to ShareExtension-Info.plist to solve this issue

...
<key>NSExtensionAttributes</key>
<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.url" OR
                ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image"
            ).@count == $extensionItem.attachments.@count
    ).@count == 1
	</string>
				...
</dict>
...

And use public.data as uti

Source: https://pspdfkit.com/blog/2016/hiding-action-share-extensions-in-your-own-apps/

@sc-keyzo
Copy link
Author

sc-keyzo commented Jul 2, 2020

@axel012 Thanks for posting this, i will try it out and let you know how i get on

@mbohlaender
Copy link

I'm getting error: unable to read property list from file: /Users//cordova/platforms/ios/ShareExtension/ShareExtension-Info.plist: The operation couldn’t be completed. (XCBUtil.PropertyListConversionError error 1.) (in target 'ShareExt' from project '') from xcode then. What can I do?

@sc-keyzo
Copy link
Author

sc-keyzo commented Oct 1, 2020

Hi, it's potentially just a typo, here's my working plist

`

    <dict>
            <key>CFBundleDevelopmentRegion</key>
            <string>en</string>
            <key>CFBundleDisplayName</key>
            <string>OpenWithItThree</string>
            <key>CFBundleExecutable</key>
            <string>$(EXECUTABLE_NAME)</string>
            <key>CFBundleIdentifier</key>
            <string>$(PRODUCT_BUNDLE_IDENTIFIER).shareextension</string>
            <key>CFBundleInfoDictionaryVersion</key>
            <string>6.0</string>
            <key>CFBundleName</key>
            <string>$(PRODUCT_NAME)</string>
            <key>CFBundlePackageType</key>
            <string>XPC!</string>
            <key>CFBundleShortVersionString</key>
            <string>1.0.0</string>
            <key>CFBundleVersion</key>
            <string>1.0.0</string>
            <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"
                                ).@count == $extensionItem.attachments.@count
                        ).@count == 1
                        </string>
                    </dict>
                    <key>NSExtensionMainStoryboard</key>
                    <string>MainInterface</string>
                    <key>NSExtensionPointIdentifier</key>
                    <string>com.apple.share-services</string>
            </dict>
    </dict>
`

@mbohlaender
Copy link

mbohlaender commented Oct 5, 2020

Thanks, app is build again. But unfortunately I'm still not able to import a document inside my app. It's just not shown as possibility in share menu.

Here's my ShareExtension-Info.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>CFBundleDevelopmentRegion</key>
        <string>en</string>
        <key>CFBundleDisplayName</key>
        <string>MyApp</string>
        <key>CFBundleExecutable</key>
        <string>$(EXECUTABLE_NAME)</string>
        <key>CFBundleIdentifier</key>
        <string>$(PRODUCT_BUNDLE_IDENTIFIER).shareextension</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
        <string>$(PRODUCT_NAME)</string>
        <key>CFBundlePackageType</key>
        <string>XPC!</string>
        <key>CFBundleShortVersionString</key>
        <string>4.4.9</string>
        <key>CFBundleVersion</key>
        <string>4.4.9</string>
        <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" OR
                                            ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.file-url" OR
                                            ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url" OR
                                            ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image"
                                        ).@count == $extensionItem.attachments.@count
                                ).@count == 1
                                </string>
                            </dict>
                            <key>NSExtensionMainStoryboard</key>
                            <string>MainInterface</string>
                            <key>NSExtensionPointIdentifier</key>
                            <string>com.apple.share-services</string>
                    </dict>
    </dict>
</plist>

Do you @sc-keyzo or @axel012 have any ideas if there is something wrong? Do I forgot to configure something else?
Btw UTI is set to: "IOS_UNIFORM_TYPE_IDENTIFIER": "public.content"

@sanek-mizin
Copy link

maybe help https://github.com/sanek-mizin/cordova-plugin-openwith

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants