Jules
Jules

Reputation: 660

nslog stopped working in xcode

I have a strange issue and possibly a bug. My NSLog statements have stopped working completely, they do not print even in view did load, application didfinishlaunching etc. The have all turned a brown colour (the same colour as a pragma mark in xcode) and they all have a warning saying 'expression result unused'. Has anyone ever seen this before or know what to do? Am i running in some kind of weird mode? Im running xcode 4.0.2.

Many thanks

Jules

Upvotes: 5

Views: 8594

Answers (8)

Hunt3rDe
Hunt3rDe

Reputation: 482

if you are using libraries like 'KScan' or 'iKEA' or 'kdc-scan', so it can happens that, they will call methods like this one 'redirectNSLogToDocuments'.

in my case the object of 'iKEA' call the method 'CheckIfDeviceConnected' and this one redirect all nslog outputs to documents. after commenting out, all nslogs works again :)

hope this will be useful for some one.

Upvotes: 0

Brian Mendez
Brian Mendez

Reputation: 27

Try changing the dropdown menu at the bottom of the console to 'All Output'.

Screenshot

Upvotes: 0

Jules
Jules

Reputation: 660

The actual problem was the release_build set to 1. So it wasn't recognizing nslog, as you said it was set for a release build.

Upvotes: 6

codiac
codiac

Reputation: 81

I had the same issue and the problem was that I was building an Ad Hoc version (schema was for Ad Hoc build). The warnings disappeared when I built for debug.

Upvotes: 0

Radix
Radix

Reputation: 3657

I had the same issue :

what worked for me is given below:

  • Remove the derived data folder
  • After removing derived data perform the clean action (You can see this option in the product menu)

  • Quit the Xcode and start it again.

And this did the trick all my NSLog were working fine.

Hoep this helps

Upvotes: 2

user1046037
user1046037

Reputation: 17725

  1. Ensure that scheme chosen corresponds to Debug mode because sometimes the pch file might have some definitions such that logging is done only in the debug mode (Scheme is on to the left of the place where you select iPhone Simulator / iOS Device)

  2. In the view select Debug Area (There are 3 view buttons, on the top right hand corner of Xcode, press the center button)

  3. Select "Show variables view and the console" (In the debug area (bottom) there are ther 3 buttons, press the center button)

Upvotes: 1

xfze
xfze

Reputation: 795

for completeness, I had the same problem and the answer was different, hope it helps someone else who bumps into this post:

I had a framework (an Amazon one) redefining NSLog, went there (Cmd+Click on the Brown NSLog) and commented out the redefinition...

Upvotes: 7

Iphone_bharat
Iphone_bharat

Reputation: 1159

some steps :-

1) "Clean all targets" or delete your build and rebuild again.

2) If step 1 doesnt work , reinstall xcode

Upvotes: -1

Related Questions