我的APP使用Alamofire库(3.0)与服务器通信。在iphone5S / iphone6 / iphone6-plus上工作正常。今天我在iphone5上测试它,我发现问题:服务器回答正确的数据(JSON),但在APP中,缺少一些数据字段。感谢任何帮助!代码段和评论如下:
AFManager.request(.GET, URLString, parameters: params, headers: headers).responseJSON { (json) -> Void in
if (json.response == nil) {
completion(nil, "connect to server failed!")
} else {
if (json.response?.statusCode)! == 200 {
if json.result.isSuccess {
let dict = json.result.value //the "value" field's content is a dictionary, having a field named "data", on iphone5, this field is missing, so the rest code can not work correctly.
completion(dict, "")
}
} else if (json.response?.statusCode)! == 401 {
completion(nil, "401")
} else {
completion(nil, "unknown error occured")
}
}