aarajput / wc_flutter_share

A Flutter plugin for sharing files & text with other applications.
Apache License 2.0
35 stars 19 forks source link

Image Sharing doesn't work on iOS #21

Closed LastxTemplar closed 4 years ago

LastxTemplar commented 4 years ago

Hi, thank you for your package, it's awesome! I have a problem though, everything works fine on Android but sharing an image on iOS doesn't work: iOS screenshot

You can see the image there in the small square but I don't have the options to share it to any other apps like Messages, Whatsapp, etc.

This is the piece of code that shares the image

    ui.Image image = await boundary.toImage();
    try {
      final ByteData bytes = await image.toByteData(format: ui.ImageByteFormat.png);
      await WcFlutterShare.share(
          sharePopupTitle: 'Share Generic Invite',
          fileName: 'hello.png',
          mimeType: 'image/png',
          bytesOfFile: bytes.buffer.asUint8List());
    } catch (e) {
      print('error: $e');
    }

I am generating an image from the screen and sharing it afterwards. This works fine in Android, not sure why iOS doesn't.

I also tried the example from this repository and when trying to share an image I get the same exact behaviour.

Thank you in advance!

aarajput commented 4 years ago

Try pressing more button on popup

LastxTemplar commented 4 years ago

I tried, it does not show more options.

aarajput commented 4 years ago

This popup is being shown by O.S. Its only showing you those apps which supports mime type image/png. Try installing skype or gmail. They will show up.

LastxTemplar commented 4 years ago

I mainly need to be able to share on whatsapp, and it works on android, why wouldnt it show up on ios?

aarajput commented 4 years ago

Try changing mime type to jpeg. I am not sure but may be ios whats app doesn't support png sharing

LastxTemplar commented 4 years ago

Hey again, sorry about this, it seems whatsapp was somehow corrupted? Reinstalling it on the phone fixed the issue and now whatsapp appears in the shareable options.

Thanks again for your work!