【问题标题】:How can I send HTML tag string in REST API by using Swift Alamofire?如何使用 Swift Alamofire 在 REST API 中发送 HTML 标签字符串?
【发布时间】:2020-01-13 03:35:17
【问题描述】:

我需要将 HTML 字符串发送到服务器。 我正在使用 Swift alamofire,当我尝试调用 Rest api 然后从服务器获取 ccs 代码响应。 与 PostMan 中使用的正文格式相同,并且运行良好。

我的请求体参数:

{body = "<br/><br/>Hi Bhavdip,<br/><br/>Please find the One-Time Password (OTP) as requested through application.<br/>OTP- 123456 <br/><br/>Kindly, enter this OTP in your mobile application to authenticate your account and change phone number.<br/><br/>Kind regard,<br/>VeriDoc Global Team.";subject = "VeriDoc Global OTP for Account Verification";toaddress = "bambhroliya.bhavdip@example.com"; toname = "Bhavdip Patel";}

回复:

无效的 json 格式。获取 CSS 代码。 参数值为

"<br/><br/>Hi Bhavdip,<br/><br/>Please find the One-Time Password (OTP) as requested through application.<br/>OTP- 123456 <br/><br/>Kindly, enter this OTP in your mobile application to authenticate your account and change phone number.<br/><br/>Kind regard,<br/>VeriDoc Global Team."

【问题讨论】:

  • "我的请求正文参数:"你能展示一些关于你是如何得到它的代码吗?另外,为什么它看起来像是 NSDictionary 而不是 Swift 字典?

标签: ios json swift swift3 swift4


【解决方案1】:
let params = [body = "<br/><br/>Hi Bhavdip,<br/><br/>Please find the One-Time Password (OTP) as requested through application.<br/>OTP- 798580 <br/><br/>Kindly, enter this OTP in your mobile application to authenticate your account and change phone number.<br/><br/>Kind regard,<br/>VeriDoc Global Team.",subject = "VeriDoc Global OTP for Account Verification",toaddress = "bambhroliya.bhavdip@tristonsoft.com", toname = "Bhavdip Patel"] as! [String:Any]

使用它作为你的参数

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-07
    • 1970-01-01
    • 1970-01-01
    • 2012-10-18
    • 1970-01-01
    • 2018-05-22
    相关资源
    最近更新 更多