【问题标题】:how to upload Image on server using Alamofire with parameters如何使用带有参数的 Alamofire 在服务器上上传图像
【发布时间】:2020-07-10 19:04:27
【问题描述】:

我仅使用 Alamofire 在服务器上上传图像(不使用任何模型类)。我已经尝试了多个链接,例如 upload image to server using Alamofire 在每个链接中我遇到了这个问题“Cannot invoke 'data' with an argument list of type '(using: String.Encoding)'” 我愿意不明白出了什么问题。请让我知道下面是我的代码:

需要的参数是

 /*
name:test, 
description:testing testing, 
image:**filetype** , 
user_id:63, 
add_by:63
*/

【问题讨论】:

  • 不要将value 转换为AnyObject。相反,只需检查 value.data(...) 不是 nil
  • 代码没有运行失败......因为它给了我红色的建议,将其更改为任何对象
  • 这只是一个建议,而不是自动修复。在这种情况下,这不是您想要的。
  • 不这样做..代码不运行..虽然运行它给构建失败
  • 您遇到什么错误? (您可能需要检查 nil 以便代码编译。)

标签: ios swift alamofire alamofireimage alamofire-upload


【解决方案1】:

您应该将值向下转换为字符串而不是 anyobect。

【讨论】:

    猜你喜欢
    • 2023-03-22
    • 1970-01-01
    • 2014-12-17
    • 1970-01-01
    • 2018-02-14
    • 2017-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多