OS开发中 ios nw_host_stats_add_src recv too small, nw_socket_set_common_sockopts setsockopt SO_NOAPNFA

错误提示如下:

2017-06-27 17:56:59.076956 6.19html[13996:677119] [] nw_host_stats_add_src recv too small, received 24, expected 28

2017-06-27 17:56:59.113802 6.19html[13996:677119] [] ____nwlog_simulate_crash_inner_block_invoke dlopen CrashReporterSupport failed

2017-06-27 17:56:59.114346 6.19html[13996:677119] [] __nwlog_err_simulate_crash simulate crash failed "nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available"

2017-06-27 17:56:59.179387 6.19html[13996:677119] [] nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available, dumping backtrace:

[x86_64] libnetcore-856.30.16

0  libsystem_network.dylib            0x000000010622f666 __nw_create_backtrace_string + 123

1  libnetwork.dylib                    0x0000000107115006 nw_socket_add_input_handler + 3164

2  libnetwork.dylib                    0x00000001070f2555 nw_endpoint_flow_attach_protocols + 3768

3  libnetwork.dylib                    0x00000001070f1572 nw_endpoint_flow_setup_socket + 563

4  libnetwork.dylib                    0x00000001070f0298 -[NWConcrete_nw_endpoint_flow startWithHandler:] + 2612

5  libnetwork.dylib                    0x000000010710bae1 nw_endpoint_handler_path_change + 1261

6  libnetwork.dylib                    0x000000010710b510 nw_endpoint_handler_start + 570

7  libnetwork.dylib                    0x00000001071231f9 nw_endpoint_resolver_start_next_child + 2240

8  libdispatch.dylib                  0x0000000105fac978 _dispatch_call_block_and_release + 12

9  libdispatch.dylib                  0x0000000105fd60cd _dispatch_client_callout + 8

10  libdispatch.dylib                  0x0000000105fb3e17 _dispatch_queue_serial_drain + 236

11  libdispatch.dylib                  0x0000000105fb4b4b _dispatch_queue_invoke + 1073

12  libdispatch.dylib                  0x0000000105fb7385 _dispatch_root_queue_drain + 720

13  libdispatch.dylib                  0x0000000105fb7059 _dispatch_worker_thread3 + 123

14  libsystem_pthread.dylib            0x000000010637f4de _pthread_wqthread + 1129

15  libsystem_pthread.dylib            0x000000010637d341 start_wqthread + 13

解决办法如下:

1.选择Product->Scheme->Edit Scheme

2.选择Arguments

3.在Environment Variables添加一个环境变量OS_ACTIVITY_MODE 设置值为”disable”

4.然后clean和build一下就好了

如图:

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容