iOS 10 doesn't print NSLogs

Tyler Sheaffer picture Tyler Sheaffer · Jun 17, 2016 · Viewed 52.3k times · Source

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

Answer

user6833743 picture user6833743 · Sep 15, 2016

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)

enter image description here

enter image description here

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.