用Xcode8進(jìn)行網(wǎng)絡(luò)請求會出現(xiàn)以下問題
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
解決方法:
進(jìn)入菜單product -> scheme -> edit scheme -> Run -> Arguments -> Environment Variables 添加環(huán)境變量OS_ACTIVITY_MODE 為 disable