objective-c 错误:协议不可用,转储回溯
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39545603/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error: Protocol not available, dumping backtrace
提问by Rahul Mayani
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 8version with ios 10. Now, I'm working an API. If, I use the API in Xcode 7its works fine but when same API I used in xcode 8error message appears Unable to parse.
我正在使用xcode 8带有ios 10. 现在,我正在开发一个 API。如果,我使用 APIXcode 7工作正常,但是当我在xcode 8错误消息中使用的相同 API出现无法解析时。
回答by Ankit Goyal
回答by Vladimir Afinello
There's no SO_NOAPNFALLBKsocket 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.
man socket 中没有SO_NOAPNFALLBK套接字选项。我猜,这个选项是苹果添加的,与推送通知服务有关,模拟器上没有。
回答by C?ur
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:
https://stackoverflow.com/a/39651073/1033581提供了一种更清晰的解决方案(比 Ankit Goyal 给出的解决方案),它可以修复模拟器日志而不影响设备日志:
- Under Product > Scheme > Edit Scheme... > Run, set the OS_ACTIVITY_MODE environment variable to ${DEBUG_ACTIVITY_MODE} so it looks like this:
- 在 Product > Scheme > Edit Scheme... > Run 下,将 OS_ACTIVITY_MODE 环境变量设置为 ${DEBUG_ACTIVITY_MODE},如下所示:


- 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:
- 转到您的项目构建设置,然后单击 + 添加名为 DEBUG_ACTIVITY_MODE 的用户定义设置。展开此设置并单击 Debug 旁边的 + 以添加特定于平台的值。选择下拉菜单并将其更改为“Any iOS Simulator SDK”。然后将其值设置为“禁用”(Xcode 8)或“默认”(Xcode 9),如下所示:
回答by Ketan
To turn off Verbose for OS Activity Mode, You simply go to (in Xcode Menu Bar)
要关闭 OS 活动模式的 Verbose,您只需转到(在 Xcode 菜单栏中)
Product -> Scheme -> Edit Scheme-> Run (Left) -> Select Arguments -> On Environment Variables,
add OS_ACTIVITY_MODE and value as disable
Product -> Scheme -> Edit Scheme-> Run (Left) -> Select Arguments -> On Environment Variables,
添加 OS_ACTIVITY_MODE 和值作为禁用

