Open shafiqshams opened 6 years ago
Hi @ShafiqEssani. Not sure but if you're still stuck with this, I took a look into plugin iOS code and found they never return failure callback, just logging some message to XCode. I created the pull request here, you can take a look: https://github.com/Telerik-Verified-Plugins/ImagePicker/pull/130
Hi @quangpdt. Unfortunately it still crash the app
GMImagePicker: User pressed cancel button
2018-07-21 16:09:31.261620+0300 docker[1875:565127] [Generic] This application is not allowed to access Photo data. (
0 PhotoLibraryServices 0x27ccbf9d
@furaiev: Which version are you using now? My pull request is merged to master and the author already released new version with this fix. You can install the latest version and try again. Hope that helps.
Hi, @quangpdt, I use the latest "@ionic-native/image-picker": "^4.7.0",
@furaiev:
You must update the native plugin first, try this: "cordova-plugin-telerik-imagepicker": "^2.2.2",
. Here is my implementation for checking permissions before requesting images from Photo:
createPicturesFromLibrary(savePath: string): Promise<string[]> {
return this.imagePicker.hasReadPermission()
.then(hasReadPermission => {
if (hasReadPermission) {
return this.imagePicker.getPictures(({
disable_popover: true
}) as any).then((fileURIs) => {
//TODO: Do something with returned fileURIs
});
} else {
return this.imagePicker.requestReadPermission()
.then(() => this.createPicturesFromLibrary(savePath))
.catch((error) => {
if (_.isEqual(error, "Access has been denied. Change your setting > this app > Photo enable") ||
_.isEqual(error, "Access has been restricted. Change your setting > Privacy > Photo enable")) {
//TODO: Handle error caused by permission
}
return Promise.reject(error);
});
}
})
}
My implementation is only applied for iOS platform so please revise before using it on other platforms although I think it should work.
Same error on Android. I tried the @quangpdt 's solution, but when I select the box "Don't ask again" and clicked at deny button, the app stuck on my screen and blocked me to do any action
@quangpdt This way it never asks for permission? It seems to trigger the catch of the requestReadPermission the first time you trigger this function (which in my case will open the native settings menu. Why doesnt the requestReadPermission callback trigger when a user actually selects an option in the pop up?
Edit: It seems i spoke to soon. When you're testing your app it seems to remember your settings (sometimes) and this caused the plugin to never enter the "permission unknown" stage since it was either true or false. Tried a new device and it worked perfectly ( using a different app id should also work) however it would be nice for Apple to add a reset permissions option when developing mode is activated on your device
The issue is very clear on iOS, that for the very first time I want to upload images and open my gallery, If the user denies the permission popup (Don’t Allow) the App crashes.
This issue is on iOS only. Need an urgent fix. Please help! TIA.