0
에서 게시 JSON 나는 다음과 같은 형식으로 JSON을 생산하고 서버에 게시하는 것을 시도하고있다 : 나는 ASIFormDataRequest
를 사용하여 데이터를 게시하고지원되지 않는 미디어 유형의 오류 - 아이폰 앱
{
"items": [
{
"id": "3",
"quantity": 0.5,
"unit": "2"
} ]
}
.
이<body>
<h1>HTTP Status 415 - Unsupported Media Type</h1>
<HR size="1" noshade="noshade"><p><b>type</b>
Status report</p><p><b>message</b>
<u>Unsupported Media Type</u></p>
<p><b>description</b> <u>The server refused this request because the request entity is in a format not supported by the requested resource for the requested method (Unsupported Media Type).</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.23</h3>
</body>
내가 어떤 실수를 할 수있다 : 나는 요청 매개 변수
응답에서NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://api.esha.com/analysis?items=%@&apikey=%@",encodeJson,ApiKey]];
//here i have send escaped json (do I really need to do this thing?)
_request = [ASIFormDataRequest requestWithURL:url];
[_request setPostValue:jsonString forKey:@"items"]; //original json string
[_request setPostValue:ApiKey forKey:@"apikey"];
[_request setRequestMethod:@"POST"];
[_request addRequestHeader:@"Content-Type" value:@"application/json"];
[_request setDelegate:self];
_request.timeOutSeconds = 60.0;
[_request startSynchronous];
, 나는 HTML 형식으로 "지원되지 않는 미디어 유형"오류를 얻고으로 URL에를 보내기 위해 JSON 문자열을 탈출 하기? 누군가 올바른 경로로 안내 할 수 있습니까? 감사.