android - Flutter multi_image_picker 相机选项未在 iOS 中显示。当我已经启用相机并在 info.plist 中写入权限时
问题描述
它显示了唯一的最近图片。我也想要一个相机选项。这是我的代码。
Future<void> loadAssets(StateSetter setModalState) async {
print("On pressed");
List<Asset> resultList = List<Asset>();
String error = 'No Error Dectected';
try {
resultList = await MultiImagePicker.pickImages(
maxImages: 2,
enableCamera: true,
selectedAssets: image,
materialOptions: MaterialOptions(
actionBarColor: "#abcdef",
actionBarTitle: "Example App",
allViewTitle: "All Photos",
useDetailsView: false,
selectCircleStrokeColor: "#000000",
),
);
} on Exception catch (e) {
error = e.toString();
}
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
setModalState(() {
image = resultList;
print("Set state");
if(image.length>0){
showUploadButton = false;
}else{
showUploadButton = true;
}
// _error = error;
//print(_error);
});
}
我不知道为什么会这样。我已经删除了应用程序并重新安装。并且还清理了 android studio。但它仍然只显示最近的图片
解决方案
写在 info.plist
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app does not require access to the microphone.</string>
<key>NSCameraUsageDescription</key>
<string>This app requires access to the camera.</string>
推荐阅读
- laravel - production.ERROR:命名空间声明语句必须是第一个语句或脚本中的任何声明调用之后
- python - 在 python 中打开一个 .mat 图像文件
- python - k-means聚类后的时间序列求和
- delphi - 检查字符串是否为正则表达式的其他方法
- sql - 将 JSON 数据从 SQL DB 导入 R 数据框
- spring - 使用 DeadLetterPublishingRecoverer 发布 Json 反序列化错误不会发布原始有效负载
- php - 如何显示表单中的复选框值并显示为 pdf php?
- javascript - 通过 HTTPS 的 Web 套接字
- julia - 如何在 Julia 中将字典值设置为零
- java - 反向列表
- > 使用集合