error = "Error Domain=com.alamofire.error.serialization.response Code=-1016

AFNetworking请求数据时经常出现这类错误,错误码是-1016,这里的关键是Request failed: unacceptable content-type: application/javascript,有的会出现Request failed: unacceptable content-type: text/html,也就是数据解析的问题,在session.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/plain", @"text/javascript", @"text/json", @"text/html",@"application/javascript" ,nil];中加上缺失的类型就行,记录以以提醒自己。

你可能感兴趣的:(error = "Error Domain=com.alamofire.error.serialization.response Code=-1016)