Type of Expression is ambiguous without more context
这是我的编码:
let URL = try! URLRequest(url: Config.imageUploadURL,method: .post,headers: headers)Alamofire.upload( multipartFormData: { multipartFormData in multipartFormData.append(self.imageData,withname: "image",filename: "file.png",mimeType: "image/png") },to: URL,enCodingCompletion: { enCodingResult in switch enCodingResult { case .success(let upload,_,_): upload.responseJsON { response in if((response.result.value) != nil) { } else { } } case .failure( _): } })Alamofire.upload(multipartFormData:to:enCodingCompletion :)对于to:参数采用URLConvertible.相反,你应该使用Alamofire.upload(multipartFormData:with:enCodingCompletion :),它带有一个URLRequestConvertible,带有:参数.
我认为URL的参数名称与URL()类型相同有助于创建奇怪的编译器错误.
以下编译对我来说:
let url = try! URLRequest(url: URL(string:"www.Google.com")!,headers: nil)Alamofire.upload( multipartFormData: { multipartFormData in multipartFormData.append(Data(),with: url,_): upload.responseJsON { response in if((response.result.value) != nil) { } else { } } case .failure( _): break } })总结
以上是内存溢出为你收集整理的在Alamofire.upload swift 3中没有更多上下文的表达类型是模糊的全部内容,希望文章能够帮你解决在Alamofire.upload swift 3中没有更多上下文的表达类型是模糊的所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)