natsuk4ze / gal

How to Save Image or Video to Photo Gallery in Flutter
https://pub.dev/packages/gal
BSD 3-Clause "New" or "Revised" License
85 stars 13 forks source link

[iOS] cannot save to target album #141

Closed takapiroid88 closed 10 months ago

takapiroid88 commented 10 months ago

Overview

Gal.putImage cannot save image to target album on iOS(iOS16) app.

help me. thank you.

Code sample

Code sample ```dart await Gal.putImage(filePath, album: 'project_album'); ```

Environment

Logs ```console Doctor summary (to see all details, run flutter doctor -v): [!] Flutter (Channel stable, 3.13.2, on macOS 12.6 21G115 darwin-arm64, locale ja-JP) ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/3.0.5/libexec/bin/dart, which is not inside your current Flutter SDK checkout at xxxxxx. Consider adding xxxxxxx to the front of your path. ! Upstream repository xxxxxxxx is not a standard remote. Set environment variable "FLUTTER_GIT_URL" to xxxxxxx to dismiss this error. [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 14.2) [✓] Chrome - develop for the web [✓] Android Studio (version 2021.2) [✓] VS Code (version 1.81.1) [✓] Connected device (5 available) [✓] Network resources ```

Logs

Logs ```console Unhandled Exception: PlatformException(asset is not found, null, null, null) #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652:7) #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310:18) #2 xxxxxxxx (project code) #3 xxxxxxxx (project code) ```
natsuk4ze commented 10 months ago

Thank you for your contribution @takapiroid88 🤝 Can you save the media file with album option is null ? I think your media path is not correct.

takapiroid88 commented 10 months ago

@natsuk4ze thank you reponse.

Can you save the media file with album option is null ?

code

    await Gal.putImage(filePath, album: null);

save successful. saved location is the same as before, “Latest”.

natsuk4ze commented 10 months ago

OK. Can you provide the value of granted? @takapiroid88

final granted = await Gal.request(toAlbum: true)

And is project_album the album your app will create with the gal package?

takapiroid88 commented 10 months ago

@natsuk4ze granted is true.

takapiroid88 commented 10 months ago

And is project_album the album your app will create with the gal package?

already exist album...

natsuk4ze commented 10 months ago

@takapiroid88 If you want to save media in an album created by someone other than your app, you will need permission for "All photos" .

See: https://github.com/natsuk4ze/gal/wiki/Permissions

natsuk4ze commented 10 months ago

Unhandled Exception: PlatformException(asset is not found, null, null, null)

BTW, Can you add steps to reproduce this error? I have no error in ios 16.4 with this code

 await Gal.putImage($path album: 'project_album');
takapiroid88 commented 10 months ago

@natsuk4ze

BTW, Can you add steps to reproduce this error?

This error was caused by my own code and had nothing to do with the problem.

If you want to save media in an album created by someone other than your app, you will need permission for "All photos" .

Is All Photo like below screenshot ? try it, but cannot save to already exist album. IMG_1008

natsuk4ze commented 10 months ago

Can you add steps or a video to reproduce it @takapiroid88 ? I am unable to reproduce it.

https://github.com/natsuk4ze/gal/assets/50433979/a604d998-4e67-4295-8b38-496263a4c440

And looking at your flutter doctor results, there may be some warnings that are occurring and that may be the problem.

takapiroid88 commented 10 months ago

@natsuk4ze sorry, I checked it and it was saved in the album.

natsuk4ze commented 10 months ago

OK🤟 I'm glad you were able to resolve.