小编Zer*_*how的帖子

Fetch API 从响应中获取原始值

我使用 React-Native 请求一些数据,这是我的代码:

    fetch('https://raw.githubusercontent.com/facebook/react-native/master/docs/MoviesExample.json')
      .then((response)=>{
        return response.json()
      })
      .then((responseJSON)=>{
        callback(responseJSON)
      })
      .catch((error)=>{
        console.error(error);
      })
      .done()
Run Code Online (Sandbox Code Playgroud)

我看到responseis 是一个Response对象,json函数代码是return this.text().then(JSON.parse),我很困惑JSON.parse?的参数是什么?这是response原始值吗?我怎么才能得到它?

promise react-native fetch-api

9
推荐指数
1
解决办法
1万
查看次数

覆盖子类UITableViewCell中的init

我想init(frame: CGRect)在子类UITableViewCell中使用ovrride .

override init(frame: CGRect) {
   super.init(frame: CGRect)
}
Run Code Online (Sandbox Code Playgroud)

但这引发了一个错误:Initializer does not ovrride a designated initializer from its super class我做错了什么?

uitableview ios swift

4
推荐指数
1
解决办法
9311
查看次数

标签 统计

fetch-api ×1

ios ×1

promise ×1

react-native ×1

swift ×1

uitableview ×1