【问题标题】:Http request error 500 only on iOSHttp 请求错误 500 仅在 iOS 上
【发布时间】:2014-01-06 16:41:59
【问题描述】:

我正在使用一个只能在 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(内部服务器错误)

【问题讨论】:

  • 你的服务器上应该有一些日志。
  • 你使用的是查询字符串参数吗?
  • 我无权访问服务器的日志
  • ASIHTTPRequest 也不是很过时吗?
  • @Carlos487 实际上是的,我有一些参数要发送

标签: ios objective-c web-services internal-server-error http-error


【解决方案1】:

嗯,我不知道为什么,但添加 [ASIHTTPRequest setSessionCookies:nil]; 让它工作!奇怪的是服务器没有发送任何cookies!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    • 1970-01-01
    • 2014-12-22
    • 2019-04-27
    • 2021-04-24
    • 2022-10-23
    相关资源
    最近更新 更多