我正在尝试从swift 2迁移到swift 3,但是在我的代码中出现以下错误:
Closure use of non-escaping parameter 'completion' may allow it to escape
这是我的代码。
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)))
}
}
}