如何解决进行网络通话时Xcode中的display_timer_callback错误?

How to solve the display_timer_callback error in Xcode when making a network call?

提问人:SwiftyDev 提问时间:7/8/2019 最后编辑:CœurSwiftyDev 更新时间:7/8/2019 访问量:419

问:

我在 Xcode 控制台中遇到了以前从未遇到过的错误。 当我滚动我的 tableView 时会发生这种情况(当我到达列表底部时,它会调用进行网络调用以获得更多结果的方法,错误不会出现在每次调用上,而是随机出现),但我没有更改任何重要代码。loadMoreRecipe()

这是有问题的错误:

2019-07-07 22:10:57.586543+0200 P10_Reciplease[6188:2107230][WindowServer] display_timer_callback: 意外状态(现在:50d5cc1f65a<预期:50d5cc80a6c)

func loadMoreRecipes(indexPath: Int) {
    print(indexPath + 1)
    guard indexPath == hits.count - 1 else { return }
    guard let apiHelper = apiHelper else { return }
    print("le nombre total de recette est : ", hits.count)
    apiHelper.from = hits.count + 1
    apiHelper.to = apiHelper.from + 10

    startAnimatingActivityIndicator()

    apiHelper.getRecipe(userIngredients: userIngredients, callback: { [weak self] (apiResult, statusCode)  in
        guard let apiResult = apiResult else {

            apiHelper.from = self?.hits.count ?? 0
            apiHelper.to = apiHelper.from + 10

            self?.switchStatusCode(statusCode: statusCode)

            if let apiHelper = self?.apiHelper {
                apiHelper.from = self?.hits.count ?? 0
                apiHelper.to = apiHelper.from + 10
            }
            self?.stopAnimatingActivityIndicator()
            return
        }
        guard !apiResult.hits.isEmpty else {
            self?.parent?.presentAlert(titleAlert: .sorry, messageAlert: .noOtherRecipesFound, actionTitle: .ok, statusCode: nil, completion: nil)
            if let apiHelper = self?.apiHelper {
                apiHelper.from = self?.hits.count ?? 0
                apiHelper.to = apiHelper.from + 10
            }
            self?.stopAnimatingActivityIndicator()
            return
        }
        self?.stopAnimatingActivityIndicator()
        self?.hits.append(contentsOf: apiResult.hits)
        self?.tableView.reloadData()
    })
} 
Swift Xcode API 回调 运行时错误

评论


答: 暂无答案