0
次のコードでJSONファイルをダウンロードしました。 その後、私は辞書の配列を取ってdownloadWebsiteData()に渡します。 この機能では、それは次のようなエラーが来る:私は使用しています。ここReact-Native:定義されていないオブジェクトはオブジェクトではありません。
Undefined is not an object (evaluating 'web files.length')
が私のコードです:重要:webFilesは、Arrayです!あなたは上記のコードでfetch
メソッド内でこの行this.downloadWebsiteData();
を見れば
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();
}
ありがとうございます!それは私の愚かな間違いだった。あなたの答えをありがとう! –