user1071621
user1071621

Reputation: 65

Where is output of NSLog() written?

I am developing an iPhone app. Is output of NSLog written in a file in iPhone? I am in situation that if I didn't write NSLog, my app would not work. I don't care it is written in my iMac. But I care if it is written in iPhone.

Upvotes: 0

Views: 4046

Answers (3)

aopsfan
aopsfan

Reputation: 2441

Quite to the contrary, the log is written in the debugger, like so:

Xcode 4 debugger

You can access the debugger by clicking on the middle button in the right-most tab bar on the navigation bar of Xcode (the tab bar is titled "View"). Your logs will looks something like this:

2011-12-09 Example[55409:40b] Log message

...giving the date, application, and some other stuff before the log message.

Upvotes: 0

Dominik Hadl
Dominik Hadl

Reputation: 3619

I'm not sure what are you trying to do, but when you call NSLog, the output is shown in the lower right window. For example if I do:

NSLog http://img576.imageshack.us/img576/791/screenshot20111209at827.png

The output will be:

Output http://img857.imageshack.us/img857/3128/screenshot20111209at828.png

Also, make sure to select the console view in Xcode

Console View http://img3.imageshack.us/img3/791/screenshot20111209at827.png

If you want to show some text in the app directly, I suggest using UILabel or UITextView :) See ya, NiCK

Upvotes: 0

Emil
Emil

Reputation: 7256

The NSLog() outputs text to the console, which can be read by the users on their devices by downloading some Console-app. It is suggested that you don't use NSLog() for anything else than error reporting in the finished products, but it's fine during testing.

Here is an approach you could do to make sure the NSLog's outputted are only being called in the finished app: http://joshhighland.com/blog/2010/04/10/dont-use-nslog-anymore/

Upvotes: 3

Related Questions