我正在使用Papaparse
并且我正在尝试解析一个 CSV 文件,该文件保存在www
.
它适用于android
和browser
平台。
但是,当涉及到 时iOS
,它会返回错误回调。
当我输出错误时,它返回undefined
.
我还检查了iOS的文件路径是否正确,并且该文件确实存在。
我已经尝试将文件路径设置为,"folder/myfile.csv"
但由于它导致错误,我尝试使用文件插件获取其完整路径。
其他人遇到同样的问题并有解决方法吗?
这是我的代码。
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
});
};
提前致谢!