I'm using Papaparse
and I'm trying to parse a CSV file which is saved in a folder within www
.
It works well with android
and browser
platform.
However, when it comes to iOS
, it returns the error callback.
When I output the error, it returns undefined
.
I also checked whether the file path for iOS is correct, and the file does exist.
I have already tried setting the file path as "folder/myfile.csv"
but since it resulted in an error, I tried to get its full path using the file plugin.
Anyone else encountered the same problem and have a workaround?
This is my code.
var getOldData = function() {
var dir = "folder/myfile.csv",
file = null;
file = (isiOS) ? cordova.file.applicationDirectory + "www/" + dir : dir;
Papa.parse(file, {
download: true,
error: function(err, file) {
console.log(">>>> PAPA PARSE ERROR");
console.log(">>>>" + err); // this returns undefined
console.log(">>>>" + file); // this returns undefined as well
},
complete: function(results) {
console.log(">>>> PAPA RESULTS");
console.log(results);
},
header: true,
dynamicTyping: true
});
};
Thanks in advance!