问题:
升级Xcode 8之后,运行项目,控制台总是打印多余的日志,如下:
nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available, dumping backtrace:
[x86_64] libnetcore-856.1.8
0 libsystem_network.dylib 0x000000010b23380e __nw_create_backtrace_string + 123
1 libnetwork.dylib 0x000000010c032194 nw_socket_add_input_handler + 3002
2 libnetwork.dylib 0x000000010c00fdb8 nw_endpoint_flow_attach_protocols + 3768
3 libnetwork.dylib 0x000000010c00edd5 nw_endpoint_flow_setup_socket + 563
4 libnetwork.dylib 0x000000010c00db34 -[NWConcrete_nw_endpoint_flow startWithHandler:] + 2612
5 libnetwork.dylib 0x000000010c028d11 nw_endpoint_handler_path_change + 1261
6 libnetwork.dylib 0x000000010c028740 nw_endpoint_handler_start + 570
7 libnetwork.dylib 0x000000010c040003 nw_endpoint_resolver_start_next_child + 2240
8 libdispatch.dylib 0x000000
解决:
- 打开Edit Scheme
2.添加环境变量 OS_ACTIVITY_MODE 为 disable即可