Swift TableView没有';t返回数of row

Swift TableView没有';t返回数of row,swift,tableview,swifty-json,Swift,Tableview,Swifty Json,所以我的问题是NumberOfRowInstitution不起作用,我尝试了所有的方法,有人能说是什么问题吗 当我试着调试代码时,它说在我的海量中有0,你忘了在dataTask中的for循环结束后重新加载tableView,所以只需在主线程上重新加载tableView import UIKit import SwiftyJSON class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource{

所以我的问题是NumberOfRowInstitution不起作用,我尝试了所有的方法,有人能说是什么问题吗


当我试着调试代码时,它说在我的海量

中有0,你忘了在
dataTask
中的for循环结束后重新加载
tableView
,所以只需在主线程上重新加载
tableView

import UIKit
import SwiftyJSON

class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource{        
    @IBOutlet weak var tableView: UITableView!    
    var mass = [String]()
    var jDatas = datas()    
    override func viewDidLoad() {
        super.viewDidLoad()        
        let url = URL(string: "https://www.quandl.com/api/v3/datasets/WIKI/AAPL.json")
        let task = URLSession.shared.dataTask(with: url!) {(data, response, error) in
            if error != nil {
                print("error")
            } else {
                if let content = data {
                    let myJson = JSON(data: content)                    
                    for item in myJson["dataset"]["data"] {                        
                        let dates = "open \(String(describing: item.1[1].string)))"                 
                        self.mass.append(dates)                      
                    }       
                }
            }
        }
        task.resume()
    }
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return mass.count
    }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! SimpleTableViewCell
        cell.datasLabel?.text = "some text"
        return cell
    }
}

tnx,工作正常)但现在当我试图在tableView中获取我的海量数据时,它会显示open nil)@SerjSemenov Welcome mate,这是因为数组不包含字符串值,但它是数字。请这样尝试
let dates=“open\(string(item.1[1].doubleValue))“
OMG我没有注意到,tnx很多)
for item in myJson["dataset"]["data"] {                        
   let dates = "open \(String(describing: item.1[1].string)))"                 
   self.mass.append(dates)                      
}
DispatchQueue.main.async {
    self.tableView.reloadData()
}