Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 接收401时ASIHttpRequest响应数据/标头为空_Iphone_Asihttprequest_Http Status Code 401 - Fatal编程技术网

Iphone 接收401时ASIHttpRequest响应数据/标头为空

Iphone 接收401时ASIHttpRequest响应数据/标头为空,iphone,asihttprequest,http-status-code-401,Iphone,Asihttprequest,Http Status Code 401,每当服务器返回401时,ASIHTTPRequest的响应数据和头字段始终为空 我只能读取设置为AsAuthenticationErrorType的状态代码和N错误代码。我正在使用Charles Web Proxy嗅探流量。我可以清楚地看到服务器正在返回一个非空的响应主体 我已尝试实现AuthenticationNeedForRequest:delegate,以查看响应数据是否为null。但是,从未调用此委托方法 下面是我用来初始化网络队列的代码: networkQueue = [[ASINet

每当服务器返回401时,ASIHTTPRequest的响应数据和头字段始终为空

我只能读取设置为AsAuthenticationErrorType的状态代码和N错误代码。我正在使用Charles Web Proxy嗅探流量。我可以清楚地看到服务器正在返回一个非空的响应主体

我已尝试实现AuthenticationNeedForRequest:delegate,以查看响应数据是否为null。但是,从未调用此委托方法

下面是我用来初始化网络队列的代码:

networkQueue = [[ASINetworkQueue alloc] init];
[networkQueue setDelegate:self];
[networkQueue setRequestDidFinishSelector:@selector(requestDidFinish:)];
[networkQueue setRequestDidFailSelector:@selector(requestDidFail:)];
并发送请求

ASIHTTPRequest * request = [ASIHTTPRequest requestWithURL:apiURL];
request.delegate = self;
request.userInfo  = userInfo;
[request setRequestMethod:method];
[networkQueue addOperation:request];
[networkQueue go];

谢谢大家!

显然,这是ASIHttpRequest以前版本中的一个bug。它应该在当前版本上修复。

显然,这是ASIHttpRequest以前版本中的一个bug。它应该在当前版本上修复。

如果您已经实现了委托方法 -(void)请求:(ASIHTTPRequest*)请求didReceiveData:(NSData*)数据


然后,responseData将为null。因为API将把数据处理移交给应用程序。

如果您已经实现了委托方法 -(void)请求:(ASIHTTPRequest*)请求didReceiveData:(NSData*)数据

然后,responseData将为null。因为API将把数据处理移交给应用程序