Nothing prints from NSLog
on Xcode 8.0 beta (8S128d). printf
is unchanged
Here\'s my code:
NSLog(@\"hello from NSLog\");
pr
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.
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)
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 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.
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)
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.