我正在使用一个仅在Android和浏览器上运行良好的网络服务器。
在iOS上,我收到错误500(内部服务器错误)
我是否应该在请求标题中添加任何参数?
(void) weatherWS:(WSManagerDelegate*)delegate withUserId:(NSString*)userId withCurrentLanguage:(NSString*)currentLanguage{
NSURL *url = [NSURL URLWithString:_urlString];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDidFinishSelector:@selector(requestSuccessCallBack:)];
[request setDidFailSelector:@selector(requestFailedCallBack:)];
int tag = [self _getRequestTag];
if (delegate) {
[_delegatesDictionary setObject:delegate forKey:[NSString stringWithFormat:@"%d",tag]];
}
[request setTag:tag];
[request setRequestMethod:@"GET"];
[request setTimeOutSeconds:60];
[request setDelegate:self];
[request startAsynchronous];
}
request.responseStatusCode
始终为500(内部服务器错误)
答案 0 :(得分:1)
嗯,我不知道为什么,但添加
[ASIHTTPRequest setSessionCookies:nil];
让它有效!!奇怪的部分是服务器没有发送任何cookie!