0

For some reason print is not printing anything to the console. I ran the debugger and it's definitely being called.

Do I need to set some kind of setting? I've got "All Output" selected

override func viewDidLoad() {
    super.viewDidLoad()
    print("viewDidLoad")
}

This is the only thing in my console

enter image description here

pkamb
  • 33,281
  • 23
  • 160
  • 191
Trevor Wood
  • 2,347
  • 5
  • 31
  • 56
  • Have you accidentally filtered the content or chosen something other than `All Output`? – AdamPro13 May 05 '18 at 02:50
  • I haven't added an filters, and it's on all output – Trevor Wood May 05 '18 at 02:57
  • 1
    try printing with NSLog and see what happens: NSLog(@"Hello World"); – Lance Samaria May 05 '18 at 03:03
  • @LanceSamaria that worked! so that means my console only displays objective C related code? Is there a setting for this? – Trevor Wood May 05 '18 at 03:10
  • No that means that it can print. NSLog displays differently then Print: https://stackoverflow.com/a/25951564/4833705 – Lance Samaria May 05 '18 at 03:15
  • Did you try exiting Xcode, restarting the simulator and seeing what happens? Did you try hooking it up to a device to see what happens. I have no idea what the problem is but sometimes Xcode gets silly and you have to restart it and the simulator. It's worth a try – Lance Samaria May 05 '18 at 03:20
  • maybe its the version your using? https://forums.developer.apple.com/thread/75439 or this: https://forums.developer.apple.com/thread/64123 – Lance Samaria May 05 '18 at 03:22
  • hmm I haven't a clue. Ah well, i'll just use NSLog for the time being. Thanks for pointing that out! – Trevor Wood May 05 '18 at 03:28
  • Is it possible you (or some library you are using) defined another `print` function? Try `Swift.print("viewDidLoad")`. If that works then you know there is some other `print` function hiding the standard one. – rmaddy May 05 '18 at 03:35
  • @TrevorWood I know you discounted it, but the console’s filter is ripe for accidental characters. The suggested filter solution is in Xcode’s UI, not in Swift. – invisible squirrel May 05 '18 at 05:59
  • @rmaddy I tried that aswell with no luck – Trevor Wood May 06 '18 at 01:55
  • @dbx I deleted everything in the filter box, no luck. Then restarted xcode and still no luck. I'll try it with an entirely different project to see if it's my xcode or not. – Trevor Wood May 06 '18 at 01:56

1 Answers1

4

Found the issue

deep in the project, hidden among lines of code...I found!

public func debugPrint(_ items: Any..., separator: String = " ", terminator: String = "\n") {}
public func print(_ items: Any..., separator: String = " ", terminator: String = "\n") {}

Actually, it was at the top of AppDelegate...oops

Trevor Wood
  • 2,347
  • 5
  • 31
  • 56