cordova-plugin-photo-library: GET cdvphotolibrary://photo?photoId=xxx net::ERR_UNKNOWN_URL_SCHEME
Hi… I’m trying to use Photo Library with Ionic 3… Unfortunately i don’t know how to resolve this error both in IOS and Android.
GET cdvphotolibrary://photo?photoId=xxx net::ERR_UNKNOWN_URL_SCHEME
It’s something that I miss or is a bug with the WKWebView
Ionic:
ionic (Ionic CLI) : 4.1.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.0
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.0.0, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.1.4, (and 11 other plugins)
System:
Android SDK Tools : 26.1.1
ios-deploy : 2.0.0
ios-sim : 7.0.0
NodeJS : v8.11.4 (/usr/local/bin/node)
npm : 6.4.0
OS : macOS High Sierra
Xcode : Xcode 10.0 Build version 10A255
this is how i call the image:
this.photoLibrary.getPhotoURL(img.id).then( image => { this.dettImg = this.sanitizer.bypassSecurityTrustUrl(image) })
Thank you for the help.
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 6
- Comments: 21
So I was digging into the code to figure out how to add support for file system URLs, when I discovered that those are already available. The URL is appended the the photo
id, separated by a semicolon. I retrieve it and use it in HTML with success even inionic-webviewlike so:@Alain1405 you did it. To solve the Problem I changed some things because I am using Ionic.
` this.photoLibrary.requestAuthorization().then(() => { photolib.getLibrary( (chunk)=>{ chunk.library.forEach( (libraryItem:any)=> {
`
And:
getImgContent(imageURL):SafeUrl{ return this.sanitizer.bypassSecurityTrustUrl(imageURL); }And in the template:
` <virtual-scroller #scroll [items]=“library”> <div *ngFor=“let img of scroll.viewPortItems” style=“display: inline-block;”>
</virtual-scroller> `Miguel
I uninstalled ionic webview and one can see all pictures of the gallery. The problem is that Filereader() does not work. It does not give any callback (readAsArrayBuffer) and one can not store the picture locally. In my App I have to use Filereader() to load Blobs and then upload them. Because Filereader does not work, I cannot use this plugin.
I installed ionic webview again and Filereader() finally works , but the list with pictures of the Photo Library are not showed (Android and iOS). The debug shows: Failed to load resource: unsupported URL or ERR_UNKNOWN_URL_SCHEME.
Please let me know, if I am doing something wrong or if you have solved this problem.
Here is my Ionic configuration.
Ionic:
ionic (Ionic CLI) : 4.1.1 (C:\Users.…\AppData\Roaming\npm\node_modules\ionic) Ionic Framework : ionic-angular 3.9.2 @ionic/app-scripts : 3.2.0
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1) Cordova Platforms : android 7.0.0 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.2.5, (and 22 other plugins)
System:
Android SDK Tools : 26.1.1 (C:\Users.…\AppData\Local\Android\android-sdk) NodeJS : v8.9.4 (C:\Program Files\nodejs\node.exe) npm : 4.6.1 OS : Windows 10
Regards,
Miguel
Also having this issue. From what I have read it’s an issue with WKWebView and has been so since forever.