nw_host_stats_add_src recv too small, received 24, expected 28
So I'm getting this appear in the console and I'm not sure whether it is an issue that I should be bothered about or not. I noticed it after attaching my app to Firebase and writing to the database with anonymous sign in. Just wondering whether I need to do anything about this and if so what those actions would be.
Thanks!
This is a bug with logs in Xcode8 + iOS10.
We can get round it in this way:
When on simulator, add the Name OS_ACTIVITY_MODE and the Value
Variables disable and check it (Product -> Scheme -> Edit Scheme -> Run -> Arguments -> Environment).
When on device, only add OS_ACTIVITY_MODE and check it(don't add the Value). You'll see the NSLog in the Xcode8 Console.
Cause: iOS 10 & Xcode 8. Also can be replicated by an odd inputField bug:
Issue belongs to an InputField whom width is smaller than the inputs
chars : 96px vs (4 * 28px)
This leads to a 100% CPU and it is fixed
when width is set to 128px
Link to the above fix and reasoning
Or just silence everything:
Press ⌘<
Edit simulator scheme by adding or setting the OS_ACTIVITY_MODE under Environment Variables in the Run Arguments to a value of disable.
Do the same for the device but remove the value for OS_ACTIVITY_MODE , leaving it empty. The logs will display for the device as they should.
I found this answer in a video on Reddit located here: https://www.reddit.com/r/ios/comments/5p0fvy/xcode_nw_host_stats_add_src_recv_too_small/
This warning comes from XCode and can be disabled by adding an Environmental variable to the Scheme's Run section. The Environmental name is OS_ACTIVITY_MODE and the value is "disable".
This appears to suppress all of the "nw_" warning messages. Note that this just suppresses the warnings. I'm not sure if the warnings are significant or not or whether this indicates that there are "real" underlying problems that should be fixed.
How to edit a Scheme's Run Environmental Variables section in XCode
Adding the OS_ACTIVITY_MODE value of "disable"
I was getting this exact same error message on Xcode-8.2 iOS-10.2, but I was not using Firebase, so I'm not sure if that makes a difference. Setting OS_ACTIVITY_MODE to disable did not solve the problem, however, I realized it was coming from the All Exceptions Breakpoint I had set. I changed it to from All to Objective-C (removing C) and it no longer stops on that line anymore. You can do this by right-clicking on breakpoint in the breakpoints tab on the left, then selecting edit, then making the change.
Related
When update to iOS 11, after run app in iPhone, I receive this message in Xcode console:
SibDiet[924:111682] refreshPreferences: HangTracerEnabled: 0
SibDiet[924:111682] refreshPreferences: HangTracerDuration: 500
SibDiet[924:111682] refreshPreferences: ActivationLoggingEnabled: 0 ActivationLoggingTaskedOffByDA:0
And now I get this message in every simulator and app.
How can I solve this problem?
You can hide this message with click left mouse button on your target, and next Edit Scheme.
After that in section Environment Variables create variable with name OS_ACTIVITY_MODE and value disable as on the picture below.
At this point, there are no data to suggest that you need to respond to this spewing of internal debugger status. BTW, these messages also appear when developing on physical devices, not just simulators.
The prior answer of disabling the Xcode Environment Variable OS_ACTIVITY_MODE will stop all such internal system messages with the unfortunate side effect of turning off console logging from NSLog() calls in ObjC. I have not checked, but it may also disable Swift print() logging.
The Xcode team should really discriminate between disabling system logging and user logging!
It seems the (refresh preferences...) problem appears on multiple platforms.
I managed to fix it on High Sierra(10.13.1) XCode 9.1 and with iOS 11.0.3 by defining OS_ACTIVITY_MODE as disable by going in XCode via
Product > Scheme > Edit Scheme > Arguments > Environment Variables
add OS_ACTIVITY_MODE disable
Note: NSLog may not work after doing this.
Similar issue is reported in the question:
How to fix refreshPreferences Message in Xcode 9 [duplicate]
Nothing prints from NSLog on Xcode 8.0 beta (8S128d). printf is unchanged
Here's my code:
NSLog(#"hello from NSLog");
printf("hello from printf");
Here's the output on iOS 9 Simulator:
2016-06-17 09:49:10.887 calmapp-dev[28517:567025] hello from NSLog
hello from printf
Here's the output on iOS 10 Simulator:
hello from printf
It could be that you added the property "OS_ACTIVITY_MODE": "disable" in the Scheme environment variables (to hide OS output from the simulator) and forgot about it, and now are running on a real device.
In Xcode 8:
Product -> Scheme -> Edit Scheme -> Run -> Arguments -> Environment Variables
Only add OS_ACTIVITY_MODE and check it(Don't add a value)
Summary:
This is a bug of Xcode 8 + iOS10, we can solve it in this way:
When using the simulator, add the Name "OS_ACTIVITY_MODE" and the Value "disable" and check it.
When on a real device, only add "OS_ACTIVITY_MODE" and check it(Don't add the Value).
You will see the NSLog in the Xcode8 Console.
If you check the Xcode 8 beta release notes, you'll find that it says:
When debugging an app running on Simulator, logs may not be visible in the console.
Workaround: Use command + / in Simulator.app to open the system log in the Console app to view NSLogs. (26457535)
the NSlog or print actually is executed but is hidden among lots of other console debug outputs to solve this issue
Open Xcode8:
Product -> Scheme -> Edit Scheme -> Run -> Arguments -> Environment Variables
add "OS_ACTIVITY_MODE" and set the Value to "disable" and check it.
click close
xcode9
add "OS_ACTIVITY_MODE" and set the Value to "default" and check it.
Also, make sure the Console is actually visible in Xcode (i.e., make sure the right-hand side icon is highlighted in blue, as per the image below). After I upgraded Xcode, it hide the Console and showed me just the Variables view. This made it look like NSLog() was not working properly, whereas it was indeed working correct, I just couldn't see the output.
I can't see NSLog output in real iOS 10 device neither. If you're using real devices, you can open Devices window from Xcode (Shift + Command + 2) and see device logs there, but it's hard to look at your app's logs because the console shows logs from system and all apps.
(I'm using Xcode 7, so it's may not Xcode's problem but iOS 10 problem)
For anyone who comes upon this in the future. The reason NSLog doesn't print to syslog in iOS 10 and iOS 11 is due to Apple changing to Unified Logging.
You can see the WWDC talk about it here: https://developer.apple.com/videos/play/wwdc2016/721/
Documentation here: https://developer.apple.com/documentation/os/logging
From 10 on you should be using os_log instead of NSLog.
How to find the logs on disk: https://www.blackbagtech.com/blog/2017/09/22/accessing-unified-logs-image/
To summarize, the logs are located in /var/db/diagnostics which can be found for a VM at /Users/USERNAME/Library/Developer/CoreSimulator/Devices/SIMULATOR-GUID/data/var/db/
Copy all items inside diagnostics and uuidtext into a single folder (don't include the folders diagnostics or uuidtext just what is inside).
Rename that folder foldername.xarchive.
Open it in Console.app or use the OSX util log: log show <path to archive> --info --predicate <options>
Hmmm... it seems like the property "OS_ACTIVITY_MODE": "disable" PREVENTS NSlog from showing up in the Xcode 9 log.
Unchecking this value in my scheme restored my logs.
I'm using Xcode 8,so I also encountered the same problem . And I solved this problem by adding value = disable on the simulator, but on a real machine I don't add value.
NSLog messages no longer displayed when I upgraded to Xcode 9.1 + iOS 11.1. Initially the accepted answer gave me a way to work around this using the Console app and enabling the Simulator (see Lucas' answer).
In the Console app under Action I tried selecting Include Debug Messages and deselecting Include Info Messages (so the Console isn't swamped with system messages). NSLog messages appeared in the Console window in Xcode but not in the Console app.
I realised there had to be a more direct way to disable or enable (i.e. default) NSLogs thanks to Coeur's comment in response to this answer. In my opinion it is the best answer because setting OS_ACTIVITY_MODE to disable or default will make more sense for beginners.
I'm having a very weird problem - as you can see in the picture below, the debug shows that the program entered to the if statement, but the value of color is shown as nil !!!
obviously that's can't be true, and I suspect that the Xcode is showing incorrect values on the inspector \ variable view (at the debug area).
I have no idea - maybe my Xcode had too much vodka?
any HELP please???
updates:
I tried to restart my mac - didn't help.
my Xcode version: 6.4
I've seen the "extracting data from value failed" message (when doing a po foo at the LLDB prompt), even on debug builds . This appears to be an LLDB bug.
A workaround that worked for me was to cast the value to the expected return type (e.g. if it's an NSNumber, po (NSNumber *)foo).
Check your scheme - Run tab on the left should have the Debug executable option checked.
If you are running on AdHoc \ Release mode, the debugger will not show the right values.
Change the "Build Configuration" to "Debug".
My app runs perfect on simulator.
But when I run it on device the app crash and display error :
"malloc: * error for object 0x17415d0c0: Invalid pointer dequeued
from free list
* set a breakpoint in malloc_error_break to debug";
I searched and set a breakpoint in malloc_error_break to debug, but still cannot find the problem. I tried to changed the scheme of project, enabled Zombie Object, but can not find the answer.
I also try to use instrument, but I am not good at it.
I've fixed this error with Xcode 8 on iOS 8.3.
I've just changed Deployment Target from 8.3 to 8.0.
If the error appears now after migration to Xcode 8 and your device works under control iOS 8 it may be temporary decision.
UPD: Xcode 8.1 beta is fixed this error.
Just fixed this same issue with Xcode 8.
Preparing an iOS10 compatible build, updated to recommended Swift Migration 2.3, runs perfectly on iOS9 and iOS10 but crashes on iOS8.4. I reverted the changes in the code and the Main.storyboard and built the same content on the iOS8 with Xcode 7.3 fixed my issues.
I met this strange error too, I google it and people said it is Swift's bug, hasn't been fixed.
I debug line by line, find out the solution.
The reason this error appears
In EditRecordVC I have generic type function func update<RO>(operation: RO) where RO : RealmOperation, RO.R == EditRecordVC.R
In its subclass ConflictedRecordEditVC, I override the function, I input update, and Xcode helps me finishing the whole function override func update<RO>(record: Record?, operation: RO?) where RO : RealmOperation, RO.R == Record, compile well.
Run the code, after the overridden function is executed, this error will appear, the Xcode will stop at some random line, nobody can find out it is caused by this function.
I debug line by line, find out I have to change the generic type to override func update<RO>(operation: RO) where RO : RealmOperation, RO.R == Record, everything will work well again.
I forget when I added the ? by mistake and Xcode isn't angry.
So check you generic type function and make sure it is exactly same with super class
I am developing the application for over 6 month.
After everithing was developed and tested, I put app aside for 2 weeks and now when I run it it start crashing without any warning:
Even if I hit Continue Execution over 20 times still nothing in log.
I have all exceptions break point and malloc_errer_break set.
App crash when I move from screen to screen (When I open 2 screen or when I close it).
Most of the time EXC_BAD_ACCESS happens when you use an object that no longer exists.
You could check for Zombies during run-time to see if you use any of your object which doesn't exist anymore.
Let me guess - you need to change a property to strong (from weak). Name of that problematic property you will find in the console after enabling check for zombies (press ⌘⇧< then check Enable Zombie Objects in Diagnostics/Memory Management)
This a very generic error, I suggest to review your code and try again and as Anc Ainu said the reason is of using an object thats no longer exists.
I recommend to set up Exception breakpoint to get place from
which your app crashes.
To make this breakpoint enabled go to breakpoint tab, then tap on plus button and choose 'Add Exception Breakpoint'.
2. And yes, enabling NSZombies also could help
you.