封闭使用非转义参数“ completion”可能使其逃逸

时间:2019-01-30 17:30:25

标签: swift3

我正在尝试从swift 2迁移到swift 3,但是在我的代码中出现以下错误:

Closure use of non-escaping parameter 'completion' may allow it to escape

image

这是我的代码。

  static func inProcessOrderDetail(endpoint: WANMyAPI) -> WPromise<WANResponse> {
    return WPromise() { completion in
      let provider = Provider.sharedProvider
      UIApplication.shared.isNetworkActivityIndicatorVisible = true
        provider.request(token: endpoint, method: .POST, parameters: endpoint.defaultParameters, httpHeaderFields: endpoint.headersParameters ){ response in
        UIApplication.shared.isNetworkActivityIndicatorVisible = false

        completion(Result.Success(Box(response)))
      }
    }
  }

0 个答案:

没有答案