反应本机性能 - 应用程序不从服务器加载内容

时间:2018-05-17 13:35:45

标签: react-native react-native-ios

我有一个反应本机应用程序,可以加载服​​务器数据和图像,以及 我使用fetch从API加载数据。

但是,应用程序仅成功加载第一个提取调用,然后无法加载对外部服务器的所有后续调用,包括普通的json提取调用和图像。第一次获取后的任何调用都将暂停

总结如此:

  • 第一次获取:成功
  • 第二,第三,......等:失败
  • 第一次获取后的图像:失败

注意:图像和json文件在浏览器上加载

代码示例:

componentDidMount() {
    this.fetchA();
    this.fetchB();
}

fetchA(url)
.then((response) => response.json())
.then((responseData) => {
  console.log(responseData);
})
.catch(error => {
    console.log(error);
});


fetchB(url)
.then((response) => response.json())
.then((responseData) => {
  console.log(responseData);
})
.catch(error => {
    console.log(error);
});

fetchB功能失败

环境:

  • React native 0.44
  • 的iOS

我google了很长时间但没有任何运气来找出问题的根源。有什么帮助吗?

0 个答案:

没有答案