用Xcode8进行网络请求会出现以下问题
nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available, dumping backtrace:
[x86_64] libnetcore-856.20.4
0 libsystem_network.dylib 0x000000010ea42682 __nw_create_backtrace_string + 123
1 libnetwork.dylib 0x000000010ed1f932 nw_socket_add_input_handler + 3100
2 libnetwork.dylib 0x000000010ecfd4f4 nw_endpoint_flow_attach_protocols + 3768
3 libnetwork.dylib 0x000000010ecfc511 nw_endpoint_flow_setup_socket + 563
4 libnetwork.dylib 0x000000010ecfb270 -[NWConcrete_nw_endpoint_flow startWithHandler:] + 2612
5 libnetwork.dylib 0x000000010ed1644d nw_endpoint_handler_path_change + 1261
6 libnetwork.dylib 0x000000010ed15e7c nw_endpoint_handler_start + 570
7 libnetwork.dylib 0x000000010ed2dae5 nw_endpoint_resolver_start_next_child + 2240
8 libdispatch.dylib 0x000000010e7bf980 _dispatch_call_block_and_release + 12
9 libdispatch.dylib 0x000000010e7e90cd _dispatch_client_callout + 8
10 libdispatch.dylib 0x000000010e7c6e6b _dispatch_queue_serial_drain + 236
11 libdispatch.dylib 0x000000010e7c7b9f _dispatch_queue_invoke + 1073
12 libdispatch.dylib 0x000000010e7ca3b7 _dispatch_root_queue_drain + 720
13 libdispatch.dylib 0x000000010e7ca08b _dispatch_worker_thread3 + 123
14 libsystem_pthread.dylib 0x000000010eb924de _pthread_wqthread + 1129
15 libsystem_pthread.dylib 0x000000010eb90341 start_wqthread + 13
解决方法:
进入菜单product -> scheme -> edit scheme -> Run -> Arguments -> Environment Variables 添加环境变量OS_ACTIVITY_MODE 为 disable