aarajput / wc_flutter_share

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

Sharing is not working while create IPA #32

Open g212gs opened 3 years ago

g212gs commented 3 years ago

When I run the code, it works perfectly fine with the following code: [Checked in iOS and Android device and simulators/device]


 // This will take screenshot of 'previewContainer' child widget and share it
  _takeScreenShot() async {
    try {
      RenderRepaintBoundary boundary = previewContainer.currentContext.findRenderObject();
      if (boundary.debugNeedsPaint) {
        print("Waiting for boundary to be painted.");
        await Future.delayed(const Duration(milliseconds: 20));
        return _takeScreenShot();
      }
      ui.Image image = await boundary.toImage(pixelRatio: 3.0);
      final directory = (await getApplicationDocumentsDirectory()).path;
      ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png);
      Uint8List pngBytes = byteData.buffer.asUint8List();

      await WcFlutterShare.share(
          sharePopupTitle: 'Screenshot',
          fileName: 'screenshot.png',
          mimeType: 'image/png',
          bytesOfFile: pngBytes);
    } on PlatformException catch (e) {
      print("PlatformException while taking screenshot :" + e.toString());
    } catch (other) {
      print("Exception while taking screenshot:" + other.toString());
    }
  }

But the same code doesn't work after creating IPA and install it on the device. - didn't check with an Android device.

aarajput commented 3 years ago

I will look into it day after tomorrow