refreshPreferences HangTracerEnabled / HangTracerDuration messages in iOS 11 + Xcode 9 - ios

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]

Related

Xcode 8 : PAC Fetch failed with error [NSURLErrorDomain:-1003] log on Console window

I’m getting some strange log on console window while working on project. These are mentioned below :
nw_parameters_set_source_application Failed to convert from PID (0) to UUID. This could lead to wrong data usage accounting.
PAC Fetch failed with error [NSURLErrorDomain:-1003]
nw_proxy_resolver_create_parsed_array PAC evaluation error
I”ve checked below links but didn’t found any useful.
Link 1
Link 2
Note : I’m using Xcode 8.3.2 with iPhone 6 Plus device (iOS 10.3) and Swift 3 language in Project. It seems that there is no issue with this.
These logs appears all of sudden although there is no change in my code.
Most important thing is that my project is working as usual. So why I’m getting this issue?
Apart from this will there be an issue when app is uploaded on AppStore?
It's system logs that does not make sense in 99% cases. You should disable this logs in scheme settings
Click on scheme icon -> Edit Scheme -> Arguments -> Environment Variables
And add that variable:

Swift keyboard extension SIGQUIT, Execution was interrupted, reason: EXC_BREAKPOINT

When I try to build and run my keyboard extension, it sometimes just crashes with a Thread 1: signal SIGQUIT.
I am not able to reproduce the error. Sometimes I can build and run my app but most of the time the keyboard just quits. This happens on an actual device. In the simulator it does not open my keyboard and says Waiting to Attach.
The console does not output any errors at first. However, if I change the dropdown to View UI Hierachy in the Debug navigator I get the following description:
Details: No plist data for fetching view hierarchy: error evaluating expression “(id)[(Class)objc_getClass("DBGViewDebuggerSupport_iOS") fetchViewHierarchyWithOptions:(id)[(Class)objc_getClass("NSDictionary") dictionaryWithObjects:(id)[(id)[(id)[(Class)objc_getClass("NSArray") arrayWithObject:(id)[(Class)objc_getClass("NSNumber") numberWithBool:1]] arrayByAddingObject:(id)[(id)[(Class)objc_getClass("NSArray") arrayWithObject:#"_UIVisualEffectBackdropView"] arrayByAddingObject:#"_UIBackdropEffectView"]] arrayByAddingObject:(id)[(Class)objc_getClass("NSNumber") numberWithBool:0]] forKeys:(id)[(id)[(id)[(Class)objc_getClass("NSArray") arrayWithObject:#"DBGViewDebuggerUseLayersAsSnapshots"] arrayByAddingObject:#"DBGViewDebuggerEffectViewsToSnapshotAsImage"] arrayByAddingObject:#"DBGViewDebuggerAlwaysEncodeLayers"]]]”: error: Execution was interrupted, reason: EXC_BREAKPOINT (code=1, subcode=0x18daddc34).
The process has been returned to the state before expression evaluation.
Method: -[DBGAbstractViewDescriber handleFetchedViewInfo:fetchError:resultHandler:]
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
I also took a screenshot of the processes.
Am I doing something wrong and how could I prevent that my keyboard extension quits all the time when running it? Is it actually a bug as it says in the description?
DISCLAIMER
It seems like something in xCode 8.2.1 is broken and the debugger is not correctly attaching to the correct process or the hosting process is not properly loading the new code.
This is a not a permanent solution but a temporary workaround.
WORKAROUND
I have been able to work around this issue by following the steps below.
Kill any process that is using your keyboard (important!)
Launch the application using the debugger so the latest code is deployed to the device
Navigate to Settings > General > Keyboards > etc.
Remove your custom keyboard
Re-add your custom keyboard
Debug the application once again
The reason this works is because removing the keyboard kills the process that is hosting the extension allowing Xcode to attach to the new binary.
As I understand this is a bug in Xcode 8.2.1. because before update my custom keyboard was working very well.
this is a temporary solution.
Run your code like always!
Bring up your keyboard until the error (SIGQUIT) appear!
Goto xcode > debug > detach
Goto again Xcode > debug > Attach to Process: attach the keyboard (it should be first process)
now, your breakpoints will work. but there are no log output unfortunately! I hope it temporary solve your problem

nw_host_stats_add_src recv too small, received 24, expected 28

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.

iOS 10 doesn't print NSLogs

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.

Xcode 6, ios 8 simulator will not boot [duplicate]

This question already has answers here:
Unable to boot iOS 8 Simulator
(2 answers)
Closed 8 years ago.
I'm getting the following error:
Error Code: (Domain = DTiPhoneSimulatorErrorDomain, Code = 2)
Any ideas?
Try opening the Simulator and from the menu select Reset Content and Settings then rebuilding your app
Is there anything interesting in ~/Library/Logs/CoreSimulator/CoreSimulator.log?
Do you see an "Unable to boot the iOS Simulator." error message in that log file or in a dialog in iOS Simulator.app? If so, that is almost always because launchd_crashed because DYLD_INSERT_LIBRARIES was set to something not compatible with the iOS Simulator runtime. Do you have any crash logs (eg: launchd_sim crashes) in ~/Library/Logs/DiagnosticReports? If so, check if they show DYLD_INSERT_LIBRARIES being set. If that's the case, your options are to either update to an OS X Yosemite host (which will deal with this issue) or unset DYLD_INSERT_LIBRARIES (likely set in /etc/launchd.conf or ~/.launchd.conf)
Another common cause of this error message is a bug mentioned in the release notes in which the current workaround is to just try again (there is a timing bug during install/launch).

Resources