moberwasserlechner / capacitor-filesharer

Capacitor plugin to download and share files for the Web, Android and iOS! Stop the war in Ukraine!
MIT License
82 stars 20 forks source link

Bug: iOS: Preview panel showing up for PDF instead of the "Share" modal #21

Closed davidmarquis closed 1 year ago

davidmarquis commented 4 years ago

Capacitor version:

Latest Dependencies:

  @capacitor/cli: 2.2.1

  @capacitor/core: 2.2.1

  @capacitor/android: 2.2.1

  @capacitor/electron: 2.2.1

  @capacitor/ios: 2.2.1

Installed Dependencies:

  @capacitor/electron not installed

  @capacitor/cli 2.0.2

  @capacitor/android 2.0.2

  @capacitor/ios 2.0.2

  @capacitor/core 2.0.2

[success] Android looking great! 👌
  Found 5 Capacitor plugins for ios:
    @byteowls/capacitor-filesharer (2.0.0)
    cordova-plugin-actionsheet (2.3.3)
    cordova-plugin-badge (0.8.8)
    cordova-plugin-dialogs (2.0.2)
    uk.co.workingedge.phonegap.plugin.launchnavigator (5.0.4)
[success] iOS looking great! 👌

Library version:

Your Plugin Configuration

FileSharer.share({
          filename: file.name,     // contains "invoice_0002.pdf"
          base64Data: base64,   // verified that this contains valid base64 encoded data
          contentType: file.type, // contains "application/pdf"
        }).catch(error => {
          console.error('File sharing failed', error.message);
        });

Affected Platform(s):

Current Behavior

When I invoke the plugin, the PDF file gets displayed in some sort of PDF preview UI instead of the Share activity modal. The PDF renders as expected, which means the data itself is OK but somehow there's no Share modal at all and there's also no way to close that preview panel.

Expected Behavior

I would have expected the Share modal to be displayed as such: https://youtu.be/p7f6yamZxCk?t=762

Sample Code or Sample Application Repo

See above.

Other Information

The iOS logs are only showing this:

WebView loaded
davidmarquis commented 4 years ago

Here's a screenshot of the preview panel that shows up:

image

moberwasserlechner commented 3 years ago

Hi,

I tested it with iOS 13+ and it always works. What ios version do you use?

BR

Rosadojonathan commented 3 years ago

Up! I'm having the exact same issue. I'm on iOS 13.7

SayWhat69 commented 3 years ago

I have the same bug with an png image.

NikJaySix commented 3 years ago

Same issue here. Previews the PDF instead of opening the share options.

kams2160 commented 3 years ago

Same here for CSV data and iOS 14.4. I see only fullscreen preview with my CSV.

FeoSilva commented 3 years ago

I fixed it by installing the pods with the command pod install inside the .xcodeproj folder

zack1013 commented 3 years ago

I fixed it by installing the pods with the command pod install inside the .xcodeproj folder

may i have more detail how to fix that? thanks.

FeoSilva commented 3 years ago

I fixed it by installing the pods with the command pod install inside the .xcodeproj folder

may i have more detail how to fix that? thanks.

After installed the dependency (npm i @byteowls/capacitor-filesharer or yarn add @byteowls/capacitor-filesharer), open the terminal in the folder where is .xcodeproject file and run the command pod install

nik736 commented 3 years ago

+1 I have the same issue with a jpg

berkayyildiz commented 3 years ago

I had same problem, it fixed after npx cap sync.

MajorPrime commented 3 years ago

We had this issue despite already using cap sync For us, we had to register the plugin (in index.tsx where we call ReactDOM.render) (cordova v2.4)

import {FileSharer} from '@byteowls/capacitor-filesharer';
import {registerWebPlugin} from '@capacitor/core';
registerWebPlugin(FileSharer);
moberwasserlechner commented 2 years ago

I released the new version 3.0.0 today

If you can and it is still relevant please test this issue with the new version. (Capacitor 3.0.0 required)

I keep this issue open a few days and close it afterwards if there is no feedback.

BR Michael

Hanho-Kim commented 2 years ago

I am currently developing on Capacitor 2.4 and it still has the exact same issue. I already tried the solutions above.

Hanho-Kim commented 2 years ago

For those who are developing on capacitor 2.0, FileSharer.share({...}) => Not working as intended. Some previewing webview is appeared without any failed/error message. (This should be fixed for preventing confusion)

Plugins.FileSharer.share({...}) => Working fine.

moberwasserlechner commented 1 year ago

Closed as outdated.