Apparence-io / CamerAwesome

📸 Embedding a camera experience within your own app shouldn't be that hard. A flutter plugin to integrate awesome Android / iOS camera experience.
https://ApparenceKit.dev
MIT License
952 stars 241 forks source link

Device lost connection #80

Closed mgeee closed 2 years ago

mgeee commented 3 years ago

Steps to Reproduce

I have a „device-lost“ problem on my real device iPhone11pro at starting/initializing Awesome-Code. On Android-Simulator everything is working fine. In my opinion, before IOS14- and/or the latest flutter-update, I had no trouble. My camera- sourcecode, has not changed, yet. Flutter doctor -v says everything fine. If I use profilemode, sometimes I can take a picture, sometimes not. If I build in XCode, the returning dialog says: "Failure Reason: Message from debugger: Terminated due to memory issue".

Here is the source-code:

...
  final PictureController _pictureController = new PictureController();

  final ValueNotifier<CameraFlashes> _switchFlash = ValueNotifier(CameraFlashes.NONE);
  final ValueNotifier<double> _zoomNotifier = ValueNotifier(0);
  final ValueNotifier<Size> _photoSize = ValueNotifier(null);
  final ValueNotifier<Sensors> _sensor = ValueNotifier(Sensors.BACK);
  List<Size> _availableSizes;
  @override
  void initState() {
    super.initState();    
  }

  @override
  void dispose() {
    super.dispose();
    _switchFlash.dispose();
    _zoomNotifier.dispose();
    _sensor.dispose();
    _photoSize.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
          fit: StackFit.expand,
          children: <Widget>[
            _buildFullscreenCamera(),
            _buildInterface(),
          ],
        ),
    );
  }

  Widget _buildFullscreenCamera() {
    return CameraAwesome(
      captureMode: ValueNotifier(CaptureModes.PHOTO),
      onPermissionsResult: _onPermissionsResult,
      selectDefaultSize: (availableSizes) {
        this._availableSizes = availableSizes;
        return availableSizes[0];
      },
      orientation: DeviceOrientation.portraitUp,
      photoSize: _photoSize,
      sensor: _sensor,
      switchFlashMode: _switchFlash,
      zoom: _zoomNotifier,
    );
  }

  _onPermissionsResult(bool granted) {...}

  Widget _buildInterface() {...}

}

If I start the code at the beginning (first build method call) of my app, that works, but if I call it later, then I run into described issue. Furthermore I had a look into Apples Instruments OS X-App and could determine, that while initializing the camera the memory increases shortly for about 300+mb. I can’t compare to IOS-Simulator, but Android-Simulator don’t produce such memory peaks. Has someone an idea what I can do next, or is this a known issue?

Expected results

What it should be

Actual results

Trace in Instruments-App:

instruments

About your device

Brand Model OS
Apple iPhone 11pro 14.4

mgeee commented 3 years ago

perhaps, the following issue is relating to it: https://github.com/flutter/flutter/issues/48016

g-apparence commented 3 years ago

Thank you reporting this. On an Iphone X we got no error. Maybe this could be related to last iOS version.

g-apparence commented 2 years ago

CLosed for inactivity