iPhone console for nslog? - iphone

How can i see nslog messages when I am testing on device? My only way right now is to have a UITextView and put message in there, there must be a better way..Thanks.
I went to seetings and turned on console but still don't know how to see them. Thanks.

These calls will output to your devices system log. You'll be able to get these from the XCode Organizer when you plug your phone back in.

There are also a few apps you can install from App Store on your device (search for free ones, with Console in their title, and ability to send emails with logs).
This is useful especially if you want to debug some errors on your beta testers devices, or don't want to connect your device every time you want to see what's in the console log.

Related

Are logs made with NSLog or CCLog stored in the iPhone? Can I retrieve them?

When testing my iOS application on a device connected to Xcode, logs from NSLog or CCLog appear in the console, which is very useful for me to debug.
When the device is not connected to Xcode, obviously I don't get such logs. And when it crashes, I simply don't know why.
Because of this, I made a question here: Is there an output log like Xcode's available locally in my iPhone?. But I have noticed that those "Device Logs" are not the logs I expected. In fact, they are greatly different from the logs I see in my Xcode console, and none of them reflects a NSLog or CCLog I have done in my project. So I guess I was looking in the wrong place.
Are NSLogs or CCLogs stored somewhere I can retrieve? I don't really understand the "Device Logs", but they really don't seem to tell me anything useful or specific.
Connect your device to your computer and in XCode, windows Organizer, you can see the devices. You can select your device and then click on Console. It should show you all the NSLog statements
Your crashes are logged in your device so you can retrieve them when you connect your phone to the XCode.
1 - Plug it in
2 - Open you XCode and go to Organizer (cmd + shift + 2)
3 - Click on Devices and then on the upper left click on Device Logs.
To add something to the other (pretty standard) answers, here's a solution for which you don't need Xcode: the idevicesyslog utility from the libimobiledevice library can also display all logs.
Bonus: if you have a jailbroken phone, you can install syslogd from Cydia and all your syslog will be saved to a file named /var/log/syslog.
Best option is to run your app from Xcode connected to a real device and look at console output (Shift-Command-Y to display/hide console view by default).
Second best option is to connect device afterwards to your mac and use iPhone Configuration Utility to view your app specific console log.
Third best option is to use some 3rd party iPhone app, which can read console log in the device (when you're on field trip or something). Warning: I made the "Console On Device" app just for this purpose, needed to debug crashes while travelling. It can display app specific logs and allows emailing them.
In my experience, most users never look at logs, so they are useless and just waste time, space, and battery. Some people look at the logs and get worried for no good reason at all, give you bad reviews ("I looked at the logs and there are lots of bugs in the code"), all with no benefit to anyone.
So get rid of the NSLogs. Best to define a macro that does NSLog in a debug build and nothing in a release build. There shouldn't be any NSLog in your source code except for that macro.

How to view logs from iPhone?

I have place several NSLog() in my iOS application, is it possible to see all the logs later on my Mac that was generated when the app ran on iPhone handset even when iPhone was not connected with Mac.
Thanks
No. You can however redirect NSLog to a file, using something like this: http://blog.coriolis.ch/2009/01/09/redirect-nslog-to-a-file-on-the-iphone/
Then you can access the file via Xcode, or upload it with your app. File usage and privacy issues apply.
Keep in mind that NSLog is supposed to be turned off in published apps, so you may want to use a different logging app. A number of NSLog alternatives are available.
Unfortunately this is not possible.
The only thing that you can get is a Crash Log.
If you need a better logging system, I suggest to take a look to CocoaLumberjack, a very powerful logging framework that gives you the opportunity to save log in files and, eventually, send them to a server.
You also have many different levels like: log info, log error, log warning, etc...
You can view crash logs from your iPhone in the Organizer.
If you want to view your own log statements, you could consider TestFlight ( http://testflightapp.com ). They offer an SDK which includes features for remote logging.
I'm fairly certain that's not possible. The device needs to be connected to the Mac in order to run in Xcode's debug mode, and you need to be in debug mode to view the console, which contains your NSLogs.
There is a crash log for every crash that occurs on the phone, which is readable after connecting to your mac. These NSLog's don't appear in this log nor do they appear anywhere else in a (semi) permanent manner.
It's possible using custom macros and a custom class which will write each message in the documents directory in a file.
If the file sharing is enabled in the app you can later download them in iTunes.
Seeing the logs in mac might not be possible. But you can send the log to testflight using TFLog(). But you will need to distribute your app through testflightapp. And integrate the sdk. I think that is what you are looking for. try out - testflightapp.com

My App works perfectly on my Droid X, reviewers complain of crashes on other devices - how to debug?

Some say it doesnt start on their HTC Hero, another says it doesnt open in their Cliq, etc. I built the entire app using my Droid X to debug. Now that the app is released, and the code is interacting with so many different types of hardware, how do I figure out what may be going wrong for these users?
In my Crash errors log I have one record of a crash, and I believe I've already fixed this. It was certainly not responsible for the crashes that users are complaining about.
Maybe you have to check manually or maybe it's a problem of multiresolution because different mobile have different resolutions. Otherwise if it is possible then you have to include crash log report in your application which send crash logs to your email id.
Or you can ask them to install crash log reporter and set your emailid to target for crash report. Try this link, first one for manually adding code to your application.
https://github.com/tomquist/Android-Error-Reporter
http://www.androidzoom.com/android_applications/tools/log-collector_tlt.html
Do you have any Logcat outputs in release mode? May be they help you out..
Alternatively, you can test it out on 3rd party mobile testing vendors.. Where in you can buy some hours and do some quick testing...

how to see console logs on iphone?

I developed an applications on gps functionality.
I stuck up with some problem, i want to see the user location coordinates from the device.
I kept NSLogs wherever its required for me, if i connect the device to mac and if i run i
am able to see the logs in console,
But in my requirement i have to roam to some other other location and i need to get the logs.
how to get logs from device?
can we get these logs by writing them to any file?
if at all we are writing to any file, after connnecting the device to itunes how to get the file where i have writtern?
thanks in advance..... :)
Maybe the Organizer's console or device log can be "written" by the app and, when connect it, you can see it on the Organizer.
Another "low technology" solution is to save on disk the data (as a Plist) and show it into the app via UITable or UITextView.
Phone Configuration Utility lets you easily create, maintain, encrypt, and install configuration profiles, track and install provisioning profiles and authorized applications, and capture device information including console logs.
It is available for Windows and Mac.
For Windows: http://support.apple.com/kb/DL1466
For Mac: http://support.apple.com/kb/DL1465
I'm using this app ConsoleLog for iPhone

Can I get console logs from my iPhone app testers?

I am testing my iPhone app with some people who install it through iTunes together with the mobile provision file that I give them. Apple has good instructions for how to get crash logs from these people, but is it also possible to get console logs from their devices? I do not have physical access to these people, otherwise I could connect their device to my computer and see the console log in Organizer. I would like to give them instructions to get me their console logs, but there doesn't seem to be a way?
Apple's iPhone Configuration Utility (available at http://www.apple.com/support/iphone/enterprise/ ) for both Mac and PC allows your users to capture log information and send it to you.
Use the iOS Console Kit from here