找到這些文章中應用代理,但無法弄清楚他們如何幫助:部分Web服務調用
let task = session.dataTask(with: request, completionHandler: {
(data, response, error) in
if error == nil {
let result = String(data: data!, encoding: String.Encoding.utf8)!
if WebService.THETA_INVALID == result {
failure(LoginService.INVALID_MESSAGE)
}
else if WebService.THETA_UNVALIDATED == result {
failure(LoginService.UNVALIDATED_MESSAGE)
}
else {
let loginCredentials = LoginCredentials()
loginCredentials.username = user
loginCredentials.password = password
loginCredentials.authorization = result
success()
}
} else {
failure(error!.localizedDescription)
}
})
task.resume()
:
Understanding crash report (Partial apply...) in Swift Swift closure crashes when called as Objective-C block
我越來越部分在下面的代碼應用代理
錯誤object.failure包含「部分應用轉發器」,我不知道這意味着什麼。我試過Google搜索,它似乎與可選項有關,但大多數事情與Thunk有關?
任何人都可以幫我指出這個問題嗎?