LeGoffMael / insta_assets_picker

An image (and videos) picker similar with Instagram, supports multi picking, crop and aspect ratio.
https://pub.dev/packages/insta_assets_picker
MIT License
79 stars 34 forks source link

version 2.0.0 ios photo_manager error #24

Closed Ko-Dean closed 8 months ago

Ko-Dean commented 10 months ago

In version 2.0.0, the following error occurs:

════════ Exception caught by photo_manager ═════════════════════════════════════
The following StateError was thrown:
Bad state: The data of the entity is null: AssetEntity(id: 8362C97A-44D9-4322-8CF2-4ECD1F9362AD/L0/001 , type: AssetType.image)

When the exception was thrown, this was the stack
#0      AssetEntityImageProvider._loadAsync
image_provider.dart:128
<asynchronous suspension>
════════════════════════════════════════════════════════════════════════════════
[✓] Flutter (Channel stable, 3.13.4, on macOS 13.4.1 22F770820d darwin-arm64
    (Rosetta), locale ko-KR)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for
      more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.82.2)
[✓] Connected device (3 available)
[✓] Network resources
LeGoffMael commented 10 months ago

Do you have any more information regarding the asset that is causing the error ? (maybe related to https://github.com/fluttercandies/flutter_photo_manager/issues/780)

LeGoffMael commented 10 months ago

I also got this error while testing today, the image was took from my iPhone (HEIF) and i believe was download from iCloud (i took it recently 3 days ago) When tapping on it again it is selected normally and no error is thrown @AlexV525 do you have any idea ?

Ko-Dean commented 10 months ago

@LeGoffMael The test was conducted on the iOS simulator, and the iPhone 14 version was conducted on iOS 16.4.

AlexV525 commented 10 months ago

@Ko-Dean Can the issue be able to reproduce using the example of photo_manager? If so please submit issues to the corresponding repo and provide steps to reproduce.

Ko-Dean commented 10 months ago

The problem occurs if icloud images are enabled. If you disable icloud photo in settings, this problem will not occur. However, there is no guarantee that all users will not use iCloud Photo, so I think the problem should be fixed.

AlexV525 commented 10 months ago

The problem occurs if icloud images are enabled. If you disable icloud photo in settings, this problem will not occur. However, there is no guarantee that all users will not use iCloud Photo, so I think the problem should be fixed.

We need more detailed steps to indicate what to fix.

Ko-Dean commented 10 months ago
  1. Run the simulator.
  2. Log in to iCloud in the simulator.
  3. Run the app.
  4. Call insta_assets_picker.
  5. The problem occurs.

An error appears to occur when images that were not downloaded from iCloud appear in the image list on the device.

AlexV525 commented 10 months ago

An error appears to occur when images that were not downloaded from iCloud appear in the image list on the device.

Sounds like there is a problem with isLocallyAvailable. We'll look into it. cc @CaiJingLong

CaiJingLong commented 10 months ago

I tried positioning after running, maybe it's a concurrency issue. There are two requests for the same asset at the same time, and the second request determines that the file exists and returns it. But the file should be an empty file at this point.

There should be two AssetEntityImageProviders pointing to the same Asset in one page.

image
CaiJingLong commented 10 months ago

An error appears to occur when images that were not downloaded from iCloud appear in the image list on the device.

Sounds like there is a problem with isLocallyAvailable. We'll look into it. cc @CaiJingLong

The existence of local files cannot be the only condition.

LeGoffMael commented 8 months ago

Fix should be available in the new 2.2.0 version