terikon / cordova-plugin-photo-library

Maintainer needed. Please contact if you're using this library in your project
MIT License
149 stars 296 forks source link

photoLibrary.getPhoto() not working on ios #90

Open kevinswartz opened 6 years ago

kevinswartz commented 6 years ago

Loving this plugin so far, thanks for your help!

I'm trying to save an image so that I can get a native url for an image, but getPhoto() is giving me an error when I use it in ios.

Here's my code:

          var fetchPhotoBlob = function(libraryItem){
            var defer = $q.defer();
            console.log('fetching blob for ', libraryItem.id);
            cordova.plugins.photoLibrary.getPhoto(
              libraryItem.id,
              function (fullPhotoBlob) {
                defer.resolve(fullPhotoBlob);
              },
              function (err) {
                console.log('unable to fetch photo blob', JSON.stringify(err))
                defer.reject(err);
              });

            return defer.promise;
          }

I get an error for any library item I pass in - "Could not fetch the image" with no other information. Likewise if I use getThumbnail() instead, I get "Could not fetch the thumbnail".

I'm using ionic, angular 1 and ios 11.0.2. Your system information:

Cordova CLI: 6.5.0 Ionic CLI Version: 2.2.2 Ionic App Lib Version: 2.1.7 ios-deploy version: 1.9.2 ios-sim version: 6.0.0 OS: macOS Sierra Node Version: v7.10.1 Xcode version: Xcode 9.0 Build version 9A235

Any suggestions? Thanks for your help!

kevinswartz commented 6 years ago

Update - looks like this is only happening for photos stored in icloud. Is there any way to retrieve those?

M-atheus commented 2 years ago

I have the same problem here, @kevinswartz were you able to solve this problem?

kevinswartz commented 2 years ago

Nope, I never did. I went with cordova-plugin-mediapicker-dmcsdk instead. Good luck!