Error: Protocol not available, dumping backtrace [duplicate]

ぐ巨炮叔叔 提交于 2019-11-26 15:17:48

问题


This question already has an answer here:

  • Hide strange unwanted Xcode logs 12 answers
2016-09-17 15:16:04.386085 appDemo[2371:94976] [] __nwlog_err_simulate_crash simulate crash already simulated **"nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available"**
2016-09-17 15:16:04.386676 appDemo[2371:94976] [] 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             0x0000000112dc780e __nw_create_backtrace_string + 123
    1   libnetwork.dylib                    0x0000000113bfa194 nw_socket_add_input_handler + 3002
    2   libnetwork.dylib                    0x0000000113bd7db8 nw_endpoint_flow_attach_protocols + 3768
    3   libnetwork.dylib                    0x0000000113bd6dd5 nw_endpoint_flow_setup_socket + 563
    4   libnetwork.dylib                    0x0000000113bd5b34 -[NWConcrete_nw_endpoint_flow startWithHandler:] + 2612
    5   libnetwork.dylib                    0x0000000113bf0d11 nw_endpoint_handler_path_change + 1261
    6   libnetwork.dylib                    0x0000000113bf0740 nw_endpoint_handler_start + 570
    7   libdispatch.dylib                   0x0000000112b44980 _dispatch_call_block_and_release + 12
    8   libdispatch.dylib                   0x0000000112b6e
2016-09-17 15:16:04.387153 appDemo[2371:94976] [] nw_endpoint_flow_attach_protocols [2 192.168.0.100:80 in_progress socket-flow (satisfied)] Attached flow protocol
2016-09-17 15:16:04.387679 appDemo[2371:94976] [] nw_connection_endpoint_report [2 192.168.0.100:80 in_progress socket-flow (satisfied)] reported event flow:start_connect

I'm using xcode 8 version with ios 10. Now, I'm working an API. If, I use the API in Xcode 7 its works fine but when same API I used in xcode 8 error message appears Unable to parse.


回答1:


I found the solution as follows:

  1. In XCode menu, Go to Product > Scheme > Edit Scheme
  2. Open the Arguments tab
  3. Add the Environment Variable :- OS_ACTIVITY_MODE is disable




回答2:


There's no SO_NOAPNFALLBK socket option in man socket. I guess, this option is added by Apple and is related to push notifications services, which are not available on simulator.




回答3:


A cleaner solution (than the one given by Ankit Goyal) that fixes Simulator logs without affecting Device logs is available at https://stackoverflow.com/a/39651073/1033581:

  1. Under Product > Scheme > Edit Scheme... > Run, set the OS_ACTIVITY_MODE environment variable to ${DEBUG_ACTIVITY_MODE} so it looks like this:

  1. Go to your project build settings, and click + to add a User-Defined Setting named DEBUG_ACTIVITY_MODE. Expand this setting and Click the + next to Debug to add a platform-specific value. Select the dropdown and change it to "Any iOS Simulator SDK". Then set its value to "disable" (Xcode 8) or "default" (Xcode 9) so it looks like this:




回答4:


To turn off Verbose for OS Activity Mode, You simply go to (in Xcode Menu Bar)

  • Product -> Scheme -> Edit Scheme-> Run (Left) -> Select Arguments -> On Environment Variables,

  • add OS_ACTIVITY_MODE and value as disable



来源:https://stackoverflow.com/questions/39545603/error-protocol-not-available-dumping-backtrace

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!