在 flutter 上使用 image_picker 时,对照片的访问权限有限,但在 iOS 上具有完全访问权限

问题描述 投票:0回答:1

我想使用 flutter 的 image_picker 插件将用户选择的照片上传到服务器。但是,当用户选择“限制访问照片”并选择应用程序可见的照片时,它会显示包含所有照片的完整库。 我正在使用 image_picker 和以下代码:

final ImagePicker imagePicker = ImagePicker(); // Check for gallery permission final hasPermission = await requestPhotosPermission(); if (!hasPermission) return false; final photoResult = await imagePicker.pickImage( source: ImageSource.gallery, maxHeight: 1280, maxWidth: 800, requestFullMetadata: false);

我也向 info.plist 添加了权限

<key>NSPhotoLibraryAddUsageDescription</key> <string>Access to the photo library is necessary.</string> <key>NSPhotoLibraryUsageDescription</key> <string>Access to the photo library is necessary.</string>

以下是选择照片并单击完成后的错误日志。它显示所有照片而不是选定的照片。

**[core] "Error returned from daemon: Error Domain=com.apple.accounts Code=7 "(null)"" [PAAccessLogger] Failed to log access with error: access=<PATCCAccess 0x283311110> accessor:<<PAApplication 0x283311120 identifierType:auditToken identifier:{pid:1112, version:3545}>> identifier:D4D1111-F111-4798-1111-F1911111A9E0 kind:intervalEvent timestampAdjustment:0 visibilityState:0 assetIdentifierCount:0 tccService:kTCCServicePhotos, error=Error Domain=NSCocoaErrorDomain Code=4097 "connection to service with pid 226 named com.apple.privacyaccountingd" UserInfo={NSDebugDescription=connection to service with pid 226 named com.apple.privacyaccountingd}**

有什么解决办法吗?谢谢。

ios flutter image-gallery photo-gallery imagepicker
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.