记一个Bug

2018-11-03  本文已影响19人  Heikki_

重后台获取以下数据,
其中"课程摘要" "系列课程" "讲座报告" 是有顺序的
安卓和使用postMan 获取数据顺序都没有问题,但是iOS端顺序不对,

是因为数据是使用dict形式传过来的 而iOS的dict是没有顺序的

不解 java 上的 map 是有顺序的吗?

  顺序对
   Alamofire.request(url, method: .post, parameters: params).responseString { (str) in
        print(str)
    }

顺序不对
        Alamofire.request(url, method: .post, parameters: params).responseJSON(completionHandler: {
            response in
            
            print(response)
            let swiftyJsonVar = JSON(response.result.value as Any)
            print(swiftyJsonVar)
        })
{
    "code": "1",
    "msg": "success",
    "data": {
        "category3": 420,
        "period": 129,
        "difficultyLevel": "简单",
        "videos": {
            "课程摘要": [
                {
                    "vID": "704",
                    "videoDuration": "11:46",
                    "videoPrice": "0.0",
                    "videoName": "人工智能科普视频,带你全面了解什么是人工智能!",
                    "vCategory": 1
                }
            ],
            "系列课程": [
                {
                    "vID": "2948",
                    "videoDuration": "01:19",
                    "videoPrice": "0.0",
                    "videoName": "DeepLocker:人工智能与新型恶意软件的出现",
                    "vCategory": 1
                }
            ],
            "讲座报告": [
                {
                    "vID": "2212",
                    "videoDuration": "08:17",
                    "videoPrice": "0.0",
                    "videoName": "AI 显微镜",
                    "vCategory": 1
                },
                {
                    "vID": "30765",
                    "videoDuration": "50:06",
                    "videoPrice": "0.0",
                    "videoName": "李开复博士 - 人工智能的未来",
                    "vCategory": 1
                },
               
        
                {
                    "vID": "45315",
                    "videoDuration": "57:44",
                    "videoName": "第11讲 越深越好?",
                    "vCategory": 1
                },
                {
                    "vID": "45316",
                    "videoDuration": "1:19:28",
                    "videoName": "第10讲 卷积神经网络",
                    "vCategory": 1
                },
                {
                    "vID": "45317",
                    "videoDuration": "59:58",
                    "videoName": "第12讲 半监督学习",
                    "vCategory": 1
                },
                {
                    "vID": "45318",
                    "videoDuration": "1:40:19",
                    "videoName": "第13讲 无监督学习",
                    "vCategory": 1
                },
                {
                    "vID": "45319",
                    "videoDuration": "30:57",
                    "videoName": "第15讲 无监督学习——邻居嵌入",
                    "vCategory": 1
                },
                {
                    "vID": "45321",
                    "videoDuration": "40:38",
                    "videoName": "第14讲 无监督学习——单词嵌入",
                    "vCategory": 1
                },
                {
                    "vID": "45344",
                    "videoDuration": "1:05:33",
                    "videoName": "第23讲 机器学习和环境做互动(第三部分)",
                    "vCategory": 1
                }
            ]
        },
        "mType": "知识讲解",
        "cName": "人工智能 AI",
        "clickRate": "2215",
        "suitablePerson": "249",
        "onlineTime": "2018-06-22",
        "courseBackground": "本课程将介绍一些人工智能和机器学习等方面的知识。",
        "localLocation": "/static/images/course/249.jpg",
        "time": "39:05:05",
        "keyword": "人工智能|AI",
        "cID": "249"
    }
}
上一篇下一篇

猜你喜欢

热点阅读