首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误的日期格式(JSON .NET)

错误的日期格式(JSON .NET)
EN

Stack Overflow用户
提问于 2016-01-16 11:31:21
回答 1查看 367关注 0票数 0

我试图在我的应用程序中使用Alamofire进行API调用,但我得到了一个奇怪的错误。

代码语言:javascript
复制
'There was an error deserializing the object of type Tucson.Geocaching.WCF.API.CreateTrackableLogRequestV1. DateTime content '\/Date(1452942271163+0500)\/' does not start with '\/Date(' and end with ')\/' as required for JSON.'

空气污染指数网站上,它说日期格式必须如下:"\/Date(928174800000-0700)\/"

我的代码:

代码语言:javascript
复制
postTBLog("GSYCNP", text: "Test", date: "\\/Date(928174800000-0700)\\/", logType: 48)

func postTBLog (code: String, text: String, date: String, logType: Int) -> Bool {
    if let apiKey = apiKey {
        let url = "https://api.groundspeak.com/LiveV6/geocaching.svc/CreateTrackableLog"
        let parameters:[String : AnyObject] = ["AccessToken":apiKey, "TrackingNumber":code, "UTCDateLogged": date, "Note":text, "LogType":logType]

        Alamofire.request(.POST, url, parameters: parameters, encoding: .JSON).responseString { response in
            print(response)
        }



        return true
    } else {
        return false
    }
}

我已经试过了不同的东西,但没有缝好。如果你能帮我我会很高兴的,泰克斯。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-01-16 11:50:07

在我把"\\/Date(928174800000-0700)\\/"变成"/Date(928174800000)/"之后它就起作用了

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34826432

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档