0

I have a mixed Swift and Objective-C project (one view controller is in objective C). When I try to print some debug output from that view controller (ie in the .m file using NSLog) I do not see any output.

My swift prints are just fine.

I made a new objective-c project and did some NSLogging, that works fine.

I added this code to my appdelegate (swift), just to immediately test: NSLog("Testing 1 2 3") print("Is this thing on?") and I also do not see the NSLog output, but I do see output from the print statement.

What madness is this?

Tom Schulz
  • 612
  • 6
  • 23
  • Possible duplicate of [iOS 10 doesn't print NSLogs](https://stackoverflow.com/questions/37886600/ios-10-doesnt-print-nslogs) – Cœur Sep 04 '18 at 03:27
  • In your scheme, change property "OS_ACTIVITY_MODE" from "disable" to "default". source: my comment at https://stackoverflow.com/questions/37886600/ios-10-doesnt-print-nslogs/39653587#comment79866921_39653587 – Cœur Sep 04 '18 at 03:27
  • "The objective c from swift" part of this was definitely a red herring. – Tom Schulz Sep 04 '18 at 10:14

2 Answers2

3

It seems like the property "OS_ACTIVITY_MODE": "disable" PREVENTS NSlog from showing up in the Xcode 9 log.

Uncheck this value in my scheme restored my logs.

Check this stack overflow post - iOS 10 doesn't print NSLogs

teja_D
  • 383
  • 3
  • 18
  • Nice, so now there's this everywhere - 2018-09-03 20:07:00.021377-0700 DriveAppIOS[3235:1533866] Status bar could not find cached time string image. Rendering in-process. My solution is to just use printf. – Tom Schulz Sep 04 '18 at 03:13
0

The solution teja_D proposes works, but then there's a lot of garbage in the logs. Myself, I am just going to use printf. Either that or reach back across the obj-c / swift barrier and make a swift object call 'print' for me.

This kind of thing really makes me shake my head.

Tom Schulz
  • 612
  • 6
  • 23