是什么导致了这个 Flutter image_picker 错误

Glo*_*obe 5 flutter imagepicker

我记得过去曾经遇到过这个问题,但不记得我是如何解决的。我有一个相当简单的功能来允许用户更新他们的个人资料图片,但第一步失败了final XFile? image = await ImagePicker().pickImage(source: ImageSource.gallery);

这是第一个错误:

2022-08-13 13:21:44.215616+0300 Runner[3940:211672] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=7 "(null)""
2022-08-13 13:21:44.230196+0300 Runner[3940:211673] [PAAccessLogger] Failed to log access with error: access=<PATCCAccess 0x2806da5b0> accessor:<<PAApplication 0x282ab0500 identifierType:auditToken identifier:{pid:3940, version:11538}>> identifier:EF438868-FF12-4741-9ACF-88D57992D9BE kind:intervalEnd timestampAdjustment:0 tccService:kTCCServicePhotos, error=Error Domain=PAErrorDomain Code=10 "Possibly incomplete access interval automatically ended by daemon"
Run Code Online (Sandbox Code Playgroud)

iOS 中此包所需的唯一设置是在我已完成的 info.plist 文件中添加权限。这也是该函数在 pub 包中的显示方式,因此它没有理由不工作。下面我将显示的错误意味着我正在使用maxWidthmaxHeight、 或尝试压缩图像,但我没有使用任何这些参数。图像文件似乎也被称为null,这就是为什么我认为上述错误是问题所在。我见过的任何其他类似问题都没有答案,大多数都在使用这些参数。我很欣赏任何想法。

错误2:

2022-08-13 13:21:44.243912+0300 Runner[3940:211261] image_picker: compressing is not supported for type (null). Returning the image with original quality
Run Code Online (Sandbox Code Playgroud)

当然,我想看看我能做些什么来解决这个问题,直到找到解决方案,所以我将图像源更改为相机而不是图库。现在 中 没有错误image_picker,但下一步是Image从 中创建一个XFile? Image.file(File(image!.path))。我必须对 进行空检查,XFile但收到错误消息,指出它为空。这意味着虽然 没有给出错误image_picker,但它实际上并没有返回图像。