0
在下面的代码中,我已经下载了一个JSON文件。 然后我把它的一个字典数组传递给downloadWebsiteData()。 在这个函数中谈到以下错误:React-Native:Undefined不是一个对象,虽然前面有一个decleration
Undefined is not an object (evaluating 'web files.length')
这里是我的代码我使用:重要:webFiles是一个数组中!
downloadWebsiteData(webFiles) {
this.setState({amountOfAllWebsites: webFiles.length});
for(var ii = 0; ii < webFiles.length; ii++)
{
var urlToDownload = webFiles[ii].url;
fetch(urlToDownload, {method: "GET"}).then((responseData) => {
this.saveDataToLocalStorage(responseData, urlToDownload);
alert('Save: '+urlToDownload);
this.setState({actuallyLoadedWebsites: this.state.actuallyLoadedWebsites++});
this.downloadWebsiteData();
})
.done();
}
谢谢!这只是我的一个愚蠢的错误。谢谢您的回答! –