【发布时间】:2021-06-09 10:14:04
【问题描述】:
我使用插件https://pub.dev/packages/image_picker
image_picker: ^0.8.0+3
在android上代码在某些设备上运行良好,但在ios上安装时,使用相机拍照时,应用程序卡在相机显示屏上
我使用 i phone 5 和 i phone 10,但都卡在相机显示屏上, “重拍”和“使用照片”按钮无法点击
这是我的代码
final pickedFile = await picker.getImage(
maxWidth: 800,
imageQuality: 85,
source: ImageSource.camera,
);
if (pickedFile != null) {
dPrint('Original path: ${pickedFile.path}');
String dir = path.dirname(pickedFile.path);
var timeStamp = DateTime.now().millisecondsSinceEpoch;
var fileName = "IMG_" + timeStamp.toString() + ".jpg";
String newPath = path.join(dir, fileName);
File newFile = await File(pickedFile.path).copy(newPath);
if (newFile != null) {
print(newFile);
}
}
Flutter 医生结果:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.0, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-ID)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] Connected device (1 available)
! Doctor found issues in 1 category.
Flutter 2.0.0 • channel stable • https://github.com/flutter/flutter.git Framework • revision 60bd88df91 (3 months ago) • 2021-03-03 09:13:17 -0800 Engine • revision 40441def69 Tools • Dart 2.12.0
【问题讨论】:
-
请添加设备详细信息(名称、型号)、
flutter doctor结果和 image_picker 库版本 -
@FaiiziiAwan 我已经添加了,请帮忙
-
请确认您的飞镖版本。运行
flutter --version -
@FaiiziiAwan 我已经添加了
-
它在我这边工作得很好。 dart 版本 2.12,设备 Iphone7 (OS 14.3),和 ImagePicker 0.8.0
标签: ios flutter imagepicker