2016-09-30 117 views
5

向ONVIF摄像机发送XML基本API请求时。它工作得很好上IOS 9的设备,但在下面的错误消息给“500内部错误”在iOS 10.错误:__tcp_connection_write_eof_block_invoke写关闭回调接收到错误 - iOS 10

的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 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 

如果用户重试,重试三至四次,然后从服务器获得有效的XML响应。

我不知道这个iOS 10的行为。

这是代码,我呼叫XML API POST请求写:

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:%@ %@\n", response, error); 
     if(error == nil) 
     { 
      NSString * text = [[NSString alloc] initWithData: data1 encoding: NSUTF8StringEncoding]; 
       NSLog(@"Data = %@",text); 
     } 
}]; 

[dataTask resume]; 

又看了Apple Form,但没有得到解决。

回答

7

试试这个代码:

我有同样的问题,但是有一些东西你可以做,

1)进入的产品 - >计划 - >编辑方案
2)润科在左边选择参数选项卡,然后在环境变量中放置这个。

OS_ACTIVITY_MODE to value : disable.

欲了解更多信息,请找到下面的截图。

enter image description here

这将摆脱在控制台消息。

但我仍与PLBuildVersion挣扎在两个实施....

我希望这可以帮助你!

+1

感谢Bhadresh,您的解决方案有助于从控制台中删除消息。但是在XML响应中仍然面临'500内部错误'。 – Punita

+0

这个错误是xml类型的问题。 –

+0

但这个相同的代码在iOS 9.0和以前的版本中工作正常。只有在iOS 10中出现'500内部错误'。 – Punita