2014-09-02 47 views
0
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem){ 
    fileSystem.root.getFile(localPath, { create: false }, function(fileEntry) { 
     doSomethingGood(); 
    }, function(err) { 
     alert(err.code); 
    }); 
}); 

在我的文件系統中存在localPath中指定的文件。我仍然收到錯誤回撥。它提醒代碼:1000。這很奇怪,因爲根據調試,錯誤代碼應該是FileError中的錯誤代碼之一,等於1到12(http://cordova.apache.org/docs/en/2.5.0/cordova_file_file.md.html#FileError)。那麼錯誤代碼1000想告訴我什麼?如果文件存在,爲什麼會拋出錯誤回調? enter image description heregetFile方法調用具有奇怪錯誤代碼(1000)的錯誤回調 - 儘管文件存在

+0

你得到你的日誌(堆棧跟蹤)任何其他錯誤?在'FileUtils' – benka 2014-09-02 12:22:59

+0

中錯誤'1000'被定義爲'UNKNOWN_ERR',你是否請求訪問文件系統? – benka 2014-09-02 12:25:42

+0

是:\t \t \t \t \t window.requestFileSystem(LocalFileSystem.PERSISTENT,0,函數(文件系統){ – Ferenjito 2014-09-02 13:09:12

回答

0

代碼1000似乎用於無效地址。

看看下面的例子(摘自我的日誌文件,在Android設備上):

Read /storage/emulated/0/Android/data/com.my.app/cache/repositories/0001/summary.jpg not found 
=> FileError code: 1 

Read cache/repositories/0001/summary.jpg not found 
=> FileError code: 1 

Read file:///repositories/0001/summary.jpg not found 
=> FileError code: 5 

Read file:///cache/repositories/0001/summary.jpg not found 
=> FileError code: 5 

Read //cache/repositories/0001/summary.jpg not found 
=> FileError code: 1000 

Read /cache/repositories/0001/summary.jpg not found 
=> FileError code: 1000 

Read //repositories/0001/summary.jpg not found 
=> FileError code: 1000 

Read /repositories/0001/summary.jpg not found 
=> FileError code: 1000 

Read //storage/emulated/0/Android/data/com.my.app/cache/repositories/0001/summary.jpg not found 
=> FileError code: 1000