405请求报错
在手端请求某个接口的时候,请求http://10.4.87.179/fleaf/services/lexin/clazz/notice/12098918/remindReceipt/pm
报错:
Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: method not allowed (405)" UserInfo={NSLocalizedDescription=Request failed: method not allowed (405), NSErrorFailingURLKey=http://10.4.87.179/fleaf/services/lexin/clazz/notice/12098918/remindReceipt/pm
, com.alamofire.serialization.response.error.data=<>, com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x111189170> { URL: http://10.4.87.179/fleaf/services/lexin/clazz/notice/12098918/remindReceipt/pm
} { Status Code: 405, Headers {
Allow = (
"POST,GET,OPTIONS,HEAD"
);
"Content-Length" = (
0
);
Date = (
"Mon, 10 Sep 2018 02:39:03 GMT"
);
Server = (
"Apache-Coyote/1.1"
);
} }}
报错:
Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: method not allowed (405)" UserInfo={NSLocalizedDescription=Request failed: method not allowed (405), NSErrorFailingURLKey=http://10.4.87.179/fleaf/services/lexin/clazz/notice/12098918/remindReceipt/pm
, com.alamofire.serialization.response.error.data=<>, com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x111189170> { URL: http://10.4.87.179/fleaf/services/lexin/clazz/notice/12098918/remindReceipt/pm
} { Status Code: 405, Headers {
Allow = (
"POST,GET,OPTIONS,HEAD"
);
"Content-Length" = (
0
);
Date = (
"Mon, 10 Sep 2018 02:39:03 GMT"
);
Server = (
"Apache-Coyote/1.1"
);
} }}
查看接口是get方法,而手端调用使用的是post方式
将手端调用接口方式改成get方式请求即可,或者将接口请求方式改为post,(保持一致即可)