Swift 3.0 unresolved identifier for DispatchQueue

后端 未结 2 708
死守一世寂寞
死守一世寂寞 2021-01-22 14:44

I have been trying to find the answer to this for hours now but still no avail. I am trying to use the following code:

func fetchPosts() {
    ref.child(\"Amore\         


        
2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-22 14:57

    Although you say you are using Swift 3.0.1, you are not. You are using Swift 2.3. Thus, there is no such thing as DispatchQueue. Your code needs to be written like this:

    let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(0.2 * Double(NSEC_PER_SEC)))
    dispatch_after(delayTime, dispatch_get_main_queue()) {
        self.tableView.reloadData()
    }
    

提交回复
热议问题