ios - 类型'NSError'在swift 4中没有成员'errorWith'?
问题描述
在以下行:
completionHandler(Result.failure(NSError.errorWith(text: "Can't download video")))
我得到:
类型“NSError”没有成员“errorWith”
当前的替代方案是什么?
解决方案
它只是意味着NSError
没有 errorWith 方法。如果你想创建NSError
任何描述,试试这个
let error = NSError(domain: "SomeErrorDomain", code: -2001 /* some error code */, userInfo: ["description": "Can't download video"])