esysberlin / esys-flutter-share

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

Share not working on released iOS app, works on sim and debug built from XCode #64

Closed kornha closed 4 years ago

kornha commented 4 years ago

Share not working in iOS testflight, works in simulator and when app is built on phone. I click the share button and nothing appears. I copied the share strategy from demo. This is a severe issue and I believe should be addressed asap.

I also tried following

  esys_flutter_share:
    git:
      url: https://github.com/aeyrium/esys-flutter-share

My code:

_didSelectShare(Post post) async {
    final Uint8List bytes = await _capturePng();
    if (bytes == null) return;
    await Share.file("Masquerade", 'masquerade.png', bytes, 'image/png');
  }

  Future<Uint8List> _capturePng() async {
    try {
      RenderRepaintBoundary boundary =
          _globalKey.currentContext.findRenderObject();

      if (boundary.debugNeedsPaint) {
        print("Waiting for boundary to be painted.");
        await Future.delayed(const Duration(milliseconds: 20));
        return _capturePng();
      }
      ui.Image image = await boundary.toImage(pixelRatio: 3.0);
      ByteData byteData =
          await image.toByteData(format: ui.ImageByteFormat.png);
      var pngBytes = byteData.buffer.asUint8List();
      return pngBytes;
    } catch (e) {
      print(e);
      return null;
    }
  }

Expected behavior This should work! Primary use case not working.

Smartphone (please complete the following information):

patuoynageek commented 3 years ago

How did you end up fixing this?