ios - Http 请求错误 500 仅在 iOS 上

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

我正在使用仅在 android 和浏览器上运行良好的网络服务器。

在 iOS 上我收到错误 500(内部服务器错误)

我应该在请求 header 中添加任何参数吗?

 (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 setSessionCookies:nil]; 让它工作!奇怪的是服务器没有发送任何 cookie!

关于ios - Http 请求错误 500 仅在 iOS 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20954791/

相关文章:

ios - 对包含 Å、Ä 和 Ö 的字符串数组进行排序 - Swift

ios - 在 Swift 中从其他类推送导航 Controller

ios - 在 ios 上使用 lldb 指定设备

ios - 无法从动态通知 Controller 发送 Watch Connectivity 消息

ios - 在 xcode 5 中重构和重命名后,符号导航器中的 View Controller 名称不会更改

ios - HockeyApp SDK 集成到 PULL 崩溃日志

objective-c - 您希望 2 年前就知道哪些 Cocoa/Core Foundation 辅助函数?

c# - HTTP Get请求错误 "Authentication failed because the remote party has closed the transport stream."

c# - 如何通过 .asmx Web 服务获取此请求结构?

web-services - 在 Go (golang) 中使用网络服务器显示 gif 图像