-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ionic 4.0.0] Failed to load resource: net::ERR_UNKNOWN_URL_SCHEME #237
Comments
I'm facing the same issue |
@chrisben , do you have any thoughts on this issue? it seems to be blocking us from implementing the image cache :/ |
@bossjon , I've resolved the issue by creating a function and utilizing actuallyNormalize(cacheUrl) {
return new Promise((resolve, reject) => {
window.resolveLocalFileSystemURL(cacheUrl, (entry: any) => {
cacheUrl = entry.toURL();
const ionicNormalizer = window['Ionic'] &&
((window['Ionic'].WebView && window['Ionic'].WebView.convertFileSrc) || window['Ionic'].normalizeURL);
if (typeof ionicNormalizer === 'function') {
cacheUrl = ionicNormalizer(cacheUrl);
resolve(cacheUrl);
} else {
reject('could not find cache url');
}
});
});
} Modified the /**
* Cache is image by using a url. If the image is already cached this method
* will return the URL
* @param src {string}
*/
public cache(src: string): Observable<string> {
return this.notifier$.pipe(
switchMapTo(
this.isCached(src)
.pipe(
flatMap(([path, success]: [string, boolean]) => {
return success ? this.getCachedFileURL(path) : this.cacheFile(path);
}),
mergeMap((url: string) => {
if (this.platform.is('ios')) {
return of(this.normalizeURlWKWview(url));
} else if (this.platform.is('cordova')) {
return from(this.actuallyNormalize(url));
}
}),
map((url: string) => {
return url;
})
)
)
);
} Note that I'm using import { from, of } from 'rxjs'; |
I am facing the same issue so I have changed in code while returning URL from getLocalCacheUrl method and need to replace because now we need URL in this format |
2+ weeks of work right here to determine that; On iOS, the problem is the version of imgcache. The latest is 2.1.1, and using that with webview 2.5.2, the map crashes with custom avatar. Reverting to imgcache version 2.0.0 (which is what we used previously), causes the map avatar to show without the map crashing on iOS. On Android, reverting imgcache alone doesn't fix the problem. Reverting from webview plugin version 2.5.2 to 2.5.1 ixes the issue (map avatar shows and app doesn't crash). However, reverting to 2.4.0 didn't fix the issue. This may explain why some older builds didn't work that formerly did, until we were using webview plugin version 2.4.0. |
error link:
cdvfile://localhost/persistent/imgcache/58f0fa6c8f79117ebbc575b1214450e63a7563d1.jpeg
screenshot
Ps: I took all the steps CORDOVA.md, but still does not work and do not understand what the problem is.
Pss: running app on android device
app.component.ts
image-cache.directive.ts
$ ionic info
The text was updated successfully, but these errors were encountered: