Tôi đang sử dụng plugin tệp cordova - cordova file pluginĐọc tệp bằng Cordova File Plugin
Tôi đang đọc tệp từ tệp văn bản. Dưới đây là mã của tôi
document.addEventListener("deviceready", function() {
window.resolveLocalFileSystemURL(cordova.file.applicationDirectory + "sameple.txt", gotFile, fail);
}, true);
function gotFile(file) {
file.file(function (file) {
var reader = new FileReader();
reader.onloadend = function (evt) {
console.log(this.result);
}
reader.readAsText(file);
}, fail());
}
function fail(e) {
console.info("FileSystem Error : " + e);
}
Vì vậy, bất cứ khi nào tôi chạy mã này, tôi nhận được các lỗi dưới đây
deviceready has not fired after 5 seconds.
Channel not fired: onPluginsReady
Channel not fired: onCordovaReady
Could not get Cordova FileSystem: Error: deviceready has not fired after 5 seconds.
"Could not get Cordova FileSystem:"
{
[functions]: ,
__proto__: { },
description: "deviceready has not fired after 5 seconds.",
message: "deviceready has not fired after 5 seconds.",
name: "Error"
}
{"data":"data"}
Sau deviceready error
sau tôi có thể nhận được các dữ liệu chính xác .. Làm thế nào để tôi giải quyết lỗi này? tôi có phải đợi thiết bị sẵn sàng thực hiện để hoàn thành không?
Bạn đã bao gồm tệp cordova.js trong tệp nguồn của mình chưa? – Gandhi
bất kỳ cập nhật nào về điều này? – Gandhi