无法以抖动方式检索保存的图像(仅在iOS上可重现该问题) [英] Unable to retrieve saved image in flutter (issue reproducible only on iOS)

查看:60
本文介绍了无法以抖动方式检索保存的图像(仅在iOS上可重现该问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SQflite保存图像,当我从头开始重新启动应用程序时,我无法再次找到图像文件.

I'm saving the image using SQflite, when I restart app from scratch I couldn't locate the image file again.

下面是供您参考的代码.

Below is the code for your reference.

  File _storedImage;

  Future<void> _takePicture() async {
    final imageFile = await ImagePicker.pickImage(
      source: ImageSource.gallery,
      maxWidth: 600,
    );
    if (imageFile == null) {
      return;
    }
    setState(() {
      _storedImage = imageFile;
    });
    final appDir = await syspaths.getApplicationDocumentsDirectory();
    final fileName = path.basename(imageFile.path);
    final savedImage = await imageFile.copy('${appDir.path}/$fileName');
    widget.onSelectImage(savedImage);
  }

以下是例外情况详细信息,供您参考.

Below is the exception details for your reference.

════════ Exception caught by image resource service ════════════════════════════
The following FileSystemException was thrown resolving an image codec:
Cannot open file, path = '/Users/*****/Library/Developer/CoreSimulator/Devices/C561CB20-67D1-4188-996C-8B06CFB483A9/data/Containers/Data/Application/0A5D4A4F-3B4B-41E5-AFBA-B1A99C2CBFDB/Documents/image_picker_6231C3D6-D4D4-4962-861B-0792D42D2C24-78611-000007A4CC408DD4.jpg' (OS Error: No such file or directory, errno = 2)

When the exception was thrown, this was the stack
#0      _File.open.<anonymous closure>  (dart:io/file_impl.dart:364:9)
(elided 13 frames from package dart:async)
Path: /Users/*****/Library/Developer/CoreSimulator/Devices/C561CB20-67D1-4188-996C-8B06CFB483A9/data/Containers/Data/Application/0A5D4A4F-3B4B-41E5-AFBA-B1A99C2CBFDB/Documents/image_picker_6231C3D6-D4D4-4962-861B-0792D42D2C24-78611-000007A4CC408DD4.jpg

推荐答案

Xcode更新似乎已解决了该问题!虽然很奇怪:-P

Xcode update seem to have fixed the issue! weird though :-P

感谢所有尝试寻找解决方案的人:)

Thanks for all of you, who tried finding a solution to this :)

这篇关于无法以抖动方式检索保存的图像(仅在iOS上可重现该问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆