Ionic 2 – (window as any).resolveLocalFileSystemURL() throwing error


I have some typescript code that uses the camera: > {
    if ('ios')) {
        this.crop.crop(imageURI, { quality: 100 }).then(newPath > {
            (window as any).resolveLocalFileSystemURL(newPath, function (fileEntry) {
        }).catch((error) > { ...

When I run the app, and use the camera function that gets used in this code, I get an error in the console (I am running on a device using the -lc parameter to view the log):

console.error: ERROR -> {"line":58535,"column":81,"sourceURL":"","__zone_symbol__currentTask":{"type":"microTask","state":"notScheduled","source":"Promise.then","zone":"angular","cancelFn":null,"runCount":0}}

line 58535 is this:

window.resolveLocalFileSystemURL(newPath, function (fileEntry) {

This line is in the main.js file that gets created by ionic on build. I have been trying to understand "source":"Promise.then" as it seems like it might point to the problem (with a promise? or not using one?). Thanks.


use the File class from ionic native means The Typescript class don’t use the javascript any type refer

import {Component} from '@angular/core';
import {File} from 'ionic-native';


  (files) > {
    // do something
  (err) > {
    // do something

Answered By – RamiReddy P

Leave a Comment