向 ONVIF 摄像头发送 XML 基础 API 请求时.它在 ios 9 设备上运行良好,但在 iOS 10 上出现500 内部错误".
XCode 8 控制台打印以下错误消息:
2016-09-30 12:39:51.295419 VCPlugin[278:10183] [] nw_socket_get_input_frames recvmsg(fd 12, 1024 bytes): [54] Connection reset by peer2016-09-30 12:39:51.301221 VCPlugin[278:10228] [] nw_socket_write_close 关机(12,SHUT_WR):[57] 套接字未连接2016-09-30 12:39:51.301307 VCPlugin[278:10228] [] nw_endpoint_flow_service_writes [3 10.107.2.153:80 就绪套接字流(已满足)] 写入请求的帧数为 0,字节数为 02016-09-30 12:39:51.301903 VCPlugin[278:10185] [] __tcp_connection_write_eof_block_invoke 写入关闭回调收到错误:[89] 操作已取消2016-09-30 12:41:13.492053 VCPlugin[278:10287] [] __tcp_connection_write_eof_block_invoke 写入关闭回调收到错误:[57] 套接字未连接2016-09-30 12:42:51.278617 VCPlugin[278:10228] [] __tcp_connection_write_eof_block_invoke 写入关闭回调收到错误:[22] 无效参数
如果用户重试并重试三到四次,则在从服务器获得有效的 xml 响应之后.
我不知道 iOS 10 的这种行为.
这是我为调用 XML API 发布请求编写的代码:
NSMutableURLRequest * urlRequest = [NSMutableURLRequest requestWithURL:url];[urlRequest setHTTPMethod:@"POST"];[urlRequest setHTTPBody:body];[urlRequest setValue:@"application/soap+xml" forHTTPHeaderField:@"Content-Type"];[urlRequest setValue:@"application/soap+xml" forHTTPHeaderField:@"Accept"];NSURLSessionDataTask * dataTask = [defaultSession dataTaskWithRequest:urlRequest completionHandler:^(NSData *data1, NSURLResponse *response, NSError *error) {NSLog(@"Response:%@ %@
", response, error);如果(错误 == 无){NSString * text = [[NSString alloc] initWithData: data1 encoding: NSUTF8StringEncoding];NSLog(@"数据 = %@",text);}}];[数据任务恢复];
还阅读了
这将消除控制台中的消息.
但我仍然在努力解决 PLBuildVersion
在两者中都实现......
希望对你有帮助!
While sending XML base API Request to ONVIF Camera. It worked fine on ios 9 device, but giving '500 Internal Error' on iOS 10.
XCode 8 Console prints below error messages:
2016-09-30 12:39:51.295419 VCPlugin[278:10183] [] nw_socket_get_input_frames recvmsg(fd 12, 1024 bytes): [54] Connection reset by peer
2016-09-30 12:39:51.301221 VCPlugin[278:10228] [] nw_socket_write_close shutdown(12, SHUT_WR): [57] Socket is not connected
2016-09-30 12:39:51.301307 VCPlugin[278:10228] [] nw_endpoint_flow_service_writes [3 10.107.2.153:80 ready socket-flow (satisfied)] Write request has 0 frame count, 0 byte count
2016-09-30 12:39:51.301903 VCPlugin[278:10185] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [89] Operation canceled
2016-09-30 12:41:13.492053 VCPlugin[278:10287] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [57] Socket is not connected
2016-09-30 12:42:51.278617 VCPlugin[278:10228] [] __tcp_connection_write_eof_block_invoke Write close callback received error: [22] Invalid argument
If user retry and retry three-to-four times, then after get valid xml response from server.
I don't know this iOS 10 behaviour.
this is code i have written for call XML API post request:
NSMutableURLRequest * urlRequest = [NSMutableURLRequest requestWithURL:url];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setHTTPBody:body];
[urlRequest setValue: @"application/soap+xml" forHTTPHeaderField:@"Content-Type"];
[urlRequest setValue: @"application/soap+xml" forHTTPHeaderField:@"Accept"];
NSURLSessionDataTask * dataTask = [defaultSession dataTaskWithRequest:urlRequest completionHandler:^(NSData *data1, NSURLResponse *response, NSError *error) {
NSLog(@"Response:%@ %@
", response, error);
if(error == nil)
{
NSString * text = [[NSString alloc] initWithData: data1 encoding: NSUTF8StringEncoding];
NSLog(@"Data = %@",text);
}
}];
[dataTask resume];
Also read Apple Form, but not get solution.
try this code:
I have the same issue, but there is something you can do to,
1) Go in Product -> Scheme -> Edit Scheme
2) Run Section on the left, select Argument Tab and in Environment Variable put this.
OS_ACTIVITY_MODE to value : disable.
For more information please find the below screenshot.
This will get rid of messages in the console.
But I still struggle with the PLBuildVersion
is implemented in both....
I hope this helps you !
这篇关于错误:__tcp_connection_write_eof_block_invoke 写入关闭回调收到错误 - iOS 10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!