wymsee / cordova-imagePicker

Cordova Plugin For Multiple Image Selection
MIT License
407 stars 858 forks source link

Selecting photos from a Shared Album results in 'null' #56

Open hanssens opened 9 years ago

hanssens commented 9 years ago

On iOS, when you select a not recently openend picture from a shared album, the getPictures() command returns null.

This can be demonstrated on iOS 8.2 with the following sample code:

window.imagePicker.getPictures(
    function (results) {
        for (var i = 0; i < results.length; i++) {
            console.log('Image URI: ' + results[i]);
        }
    }, function (error) {
        // note: in cases of a shared library this results simply in 'null'
        console.log('Error: ' + error);
    }
);

I have tested this in the case when having the Optimize Storage feature disabled. It seems that older pictures in a shared album, or pictures originating from another author (like a family member), are quite suitable to reproduce this bug. But this does not occur for all photos in a shared album.

mattchete commented 9 years ago

would be interested in a solution :)

CSullivan102 commented 9 years ago

It looks like the issue is when the full image isn't on the device (which I believe is the case with a shared album). I believe the ELCImagePickerController (which we use in this plugin), had this issue fixed, though I don't believe it's going and fetching the image, just handling the situation a bit better.

I'll try and get that change incorporated soon to be more predictable.

As far as actually fetching the image, it just isn't a super high priority for us, so I don't expect I'll get to that part soon, but we always welcome PRs!

MrBasque commented 9 years ago

Can't wait! :)

hanssens commented 9 years ago

As an update to this, the GMImagePicker plugin has fixed this by adding full iOS8 PhotoKit support. The lack of support for iOS 8's PhotoKit framework seems to be still an open issue with ELCImagePicker.

Therefor, some colleagues of mine have experimented with it and created a stable version of the ImagePicker where the ELC is replaced with GM. Also, we've added some features such as providing an array of return values containing both the original image path as well as a thumb path. So perhaps it's worth a look, @CSullivan102?

The GMImagePicker also has a downside where it requires iOS8 as a minimum, abandoning support for older OS versions.

mrdevnet commented 8 years ago

You can try to use update library with Photos library update for iOS 8 onwards with iCloud sync. At https://github.com/amitbobade2007/ELCImagePickerController. Forked from latest master branch and update for support.