Issue
I have some typescript code that uses the camera:
this.camera.getPicture(this.optionsGetCamera).then((imageURI) => {
if (this.platform.is('ios')) {
this.crop.crop(imageURI, { quality: 100 }).then(newPath => {
console.log(newPath);
(window as any).resolveLocalFileSystemURL(newPath, function (fileEntry) {
this.readFile(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":"http://192.168.1.131:8100/build/main.js","__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.
Solution
use the File class from ionic native means The Typescript class don't use the javascript any type refer https://ionicframework.com/docs/native/file/
import {Component} from '@angular/core';
import {File} from 'ionic-native';
...
File.listDir(cordova.file.applicationDirectory,
'mySubFolder/mySubSubFolder').then(
(files) => {
// do something
}
).catch(
(err) => {
// do something
}
);
Answered By - RamiReddy P
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.