swift - UserInfo={NSDebugDescription=字符 0 周围的值无效。}
问题描述
尝试使用 MailGun 从 iOS 发送电子邮件的图像。我已经设置了一个试用帐户进行测试。我正在使用此代码发送:
let parameters = [
"from": "my@mail.com",
"to": "you@mail.com",
"subject": "Hello from Swift",
"text": "Mail sendt from MailGun"]
let header : HTTPHeaders = [
"Authorization": "myAPIKey",
"Content-Type" : "application/x-www-form-urlencoded"]
let url = "My URL"
AF.request(url,
method: .post,
parameters: parameters,
encoding: URLEncoding.default,
headers: header)
.responseJSON { response in
print("Response: \(response)")
}
这给出了错误:
> Response:
> failure(Alamofire.AFError.responseSerializationFailed(reason:
> Alamofire.AFError.ResponseSerializationFailureReason.jsonSerializationFailed(error:
> Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around
> character 0." UserInfo={NSDebugDescription=Invalid value around
> character 0.})))
这哪里出错了?
解决方案
推荐阅读
- angular - Angular2 component constructor didn't called
- google-apps-script - Google Apps Script moving file to Team Drive folder
- c - 有没有办法避免在运行时缓存数据?
- jmeter - 为什么我的 TC 在 Jmeter 中不应该工作?
- python - 在 Selenium 中显示单击另一个选项卡而不是当前(默认)选项卡
- javascript - Return mouse position at a given time
- android - 如何使文本到语音的声音听起来更人性化,更少机器人化?
- android-studio - 检测连接的 USB 设备
- windows - 杀死进程时从命令行处理“放弃未保存的数据并关闭”
- snowflake-cloud-data-platform - 通过雪管/外部与内部的连续负载