以下のコードTizen Webアプリケーションは、ウェアラブル:TypeMismatchError
var fileHandler = {
storages:null,
documentsDIR:null,
newFile:null,
dirName:"documents",
fileName:"test.csv",
init: function init(){
//tizen.filesystem.listStorages(this.checkCorruptedRemovableDrives);documents
tizen.filesystem.resolve(this.dirName, this.resolveSuccessCB,this.resolveErrorCB,"rw");
},
resolveSuccessCB: function resolveSuccessCB(result){
this.documentsDir = result;
//this.newFile = documentsDir.createFile(this.fileName);
// Error Here - TypeMismatchError: Value is not Object
result.listFiles(this.listFilesSuccessCB);
console.log("All Good in "+this.documentsDir);
},
resolveErrorCB: function resolveErrorCB(error){
console.log("Unable to access "+this.dirName+". Error:"+error.message);
},
listFilesSuccessCB: function listFilesSuccessCB(files){
for (var i = 0; i < files.length; i++){
/* Display the file name and URI */
console.log("File name is " + files[i].name + ", URI is " + files[i].toURI());
}
},
onStorage: function onStorage(storage){
console.log("Storage found:" + storage.label);
},
checkCorruptedRemovableDrives: function checkCorruptedRemovableDrives(storages){
this.storages = storages;
for (var i = 0; i < storages.length; i++)
{
if (storages[i].type != "EXTERNAL"){
continue;
}
if (storages[i].state == "UNMOUNTABLE"){
console.log("External drive " + storages[i].label + " is corrupted.");
} else {
console.log(" Storage = " + storages[i].label);
// Error here - TypeMismatchError: Value is not Object
tizen.filesystem.getStorage(storages[i].label, this.onStorage);
}
}
}
}でTypeMismatchError: Value is not Object
を取得します。
エラーはエラー2つの場所で発生します。ここではのコードになります。
tizen.filesystem.getStorage(storages[i].label, this.onStorage);
では、最初の引数のデータ型はDOMStringであり、storages[i].label
もDOMString型です。 の場合result.listFiles(this.listFilesSuccessCB);
はコールバック機能を必要とします。
コードのほとんどはTizen FileSystem Guideから貼り付けられてコピーされていますが、まだ動作していません。
助けてください。少し早いですがお礼を!! また、私がウェアラブルデバイスのファイルシステムを閲覧するとき、 "documents"ディレクトリはどこにありますか?
詳細コードを教えてください。 –