Error: Protocol not available, dumping backtrace
Solution 1
I found the solution as follows:
- In XCode menu, Go to Product > Scheme > Edit Scheme
- Open the Arguments tab
- Add the Environment Variable :-
OS_ACTIVITY_MODE
isdisable
Solution 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.
Solution 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:
- Under Product > Scheme > Edit Scheme... > Run, set the OS_ACTIVITY_MODE environment variable to ${DEBUG_ACTIVITY_MODE} so it looks like this:
- 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:
Solution 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
Related videos on Youtube
Rahul Mayani
Full Stack Developer Experienced iOS & Python Developer with a demonstrated history of working in the outsourcing/offshoring industry. Skilled in Research, iOS Development, Python Scripting, Python Web Development (Django & Flask), Indoor Navigation, Augmented Reality, Keyboard Extensions, Hologram Video and Leadership. Strong engineering professional with a Bachelor of Engineering (BEng) focused in Computer Engineering from GEC-Rajkot. Library: https://github.com/Rahul-Mayani/RRCombineAlamofireAPI
Updated on September 28, 2020Comments
-
Rahul Mayani over 3 years
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 withios 10
. Now, I'm working an API. If, I use the API inXcode 7
its works fine but when same API I used inxcode 8
error message appears Unable to parse.-
pedrouan over 7 yearsThen 'check versions' :)
-
Rahul Mayani over 7 yearsWhich version I'm checking?
-
pedrouan over 7 yearsYour API. Keep in mind, that your API can miss some important updates, as there are many changes in iOS 10 SDK, at least important delegate methods and that ones in your API may not listen to.
-
Rahul Mayani over 7 yearsEverything is ok...
-
pedrouan over 7 yearsAre you using Xcode 8 official or Beta? It used to give this noisy debug output. Everything is working, either?
-
Rahul Mayani over 7 yearsI'm using xcode 8 officially not Beta version...
-
Ankit Goyal over 7 yearsany update ? I am getting the same problem.
-
Rahul Mayani over 7 years@Ankit Goyal No, dude....
-
Ankit Goyal over 7 yearsplease accept my answer, if it works for you. it is working for me :)
-
Rahul Mayani over 7 yearsThanks working is perfectly...
-
-
BilalAhmed over 7 yearsWhere to use this code ? I have the same error
-
Ankit Goyal over 7 yearsI have clearly mentioned the steps with the screenshot. Please follow the steps and let me know if you still face the issue. @BilalAhmed. Don't forget to accept the answer, if it works for you :)
-
BilalAhmed over 7 yearsIt didn't work for me, I am using xcode 8.1 and iOS 10.6 and my rest api is deployed on IIS with http:// I am not sure what that error is and how to solve this, please help.
-
Abhishek Nalin over 7 yearsI am using React Native and getting the same exception. What do you mean by try the code? Can you please mention where am I suppose to add the snippet of code which you provided?
-
Ankit Goyal over 7 yearsDear @AbhishekNalin, Go to Edit scheme and add Environment Variable there as mentioned above. After that use your own code to hit API and you will see that the problem vanishes. Hope this will help you :)
-
iYoung over 7 years@AnkitGoyal I tried above solution, but still getting same error in console logs.
-
Arpit B Parekh over 7 years@Ankit there is no need to stop OS_ACTIVITY_MODE, It is good that error comes, It is like some message comes, that something missing/incomplete happens.
-
user1244109 over 7 yearsno explanation what
OS_ACTIVITY_MODE
is, and what disabling it does. Also, not clear what is up with all that code. -
masam over 7 yearsThis option will also hide NSLog's from a real device which is often undesired. Better solution is here stackoverflow.com/questions/37800790/…
-
gbryant over 7 yearsIf you are only an intermittent xcode user (like me) and are having trouble finding Edit Scheme, it is under "Product->Scheme" on the menu bar, and has a short cut of "(command)-<".
-
Milan Kamilya about 7 yearsThanks for the answer. Do you think is it a good practice to disable OS_ACTIVITY_MODE? because if you disable it, you won't get a warning for the auto layout issues, other warnings, and crash's stack trace.
-
Cœur about 7 years@MilanKamilya This answer aims at not disabling it in Release. As for not disabling it in Debug, it is also better, until the day you get too many unwanted logs.
-
JamesG over 6 yearsThe accepted answer didn't work for me but this option did. Thank you !!
-
Cœur over 6 yearsThis solution will hide all NSLog starting with Xcode 9. To keep NSLog, replace
disable
withdefault
. -
Naresh about 6 yearsOS_ACTIVITY_MODE disable can disable all log function.