iphone - device logging - iphone

While fiddling around with the settings on the device I'm testing my app on (iPod Touch) I saw a development setting where I can turn logging on.
Does anyone know where this logs to? I know I can see log statements via the console but I'm hoping to get some log statement when the device isn't connect to my computer.

Your device will continue logging even when it's not connected to your mac. To see the logs, you need to open Xcode, click the 'Window' menu item, and then 'Organizer'. Then select your device and then select the 'Device Logs' tab. For some reason (for me at least) viewing the logs seems flaky, so if nothing shows up, you may need to completely quit Xcode and restart it.

You have to go into the Xcode organizer, and click on your device. The logs will then show up in that window.

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.

Crash reports from app on App Store

I have just released an application on the App Store but for some users the app will crash. I am not able to reproduce this problem and therefore I was wondering if there is any way to get a crash report from the user so that I can get an idea of why the app will crash.
Being only a very part-time iOS developer and having a small app that doesn't have too much going on, I've not until recently had cause to try and find crash logs. Google led me to this very old thread.
Just in case anyone else ends up on the same wild goose chase - at the time of writing (mid-2018) iTunes Connect has been rebuilt as App Store Connect and, in the web portal, all you can see is number of crashes and so-forth. To download energy usage and crash report logs from Apple servers, you actually go to XCode. Window -> Organizer -> Energy or Crashes tab [EDIT: Still correct in June 2022, XCode 13.4.1].
You can get crash reports via iTunes Connect. Here's how:
Log into iTunes Connect
Click "Manage your Applications"
Select your app
Click the app icon under "Current Version"
Click "Crash Reports" on the right side
URL : https://developer.apple.com/news/?id=nra79npr
But make sure you have configured your appstoreconnects credentials in xcode.
Just in case someone is still looking for this answer in 2019, here is how i did it.
1.) Login to Apple iTunes Connect
2.) Goto My Apps >> Select your app >> Activity
3.) Select your build number
4.) Select Download dSYM in General information
The below link helped me and you can find other ways to download dSYM (e.g.: from Xcode) from here.
References: https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-ios/configuration/retrieve-dsyms-bitcode-apps
hey i thorogly search and find this
iOS 5 and later Tapping Settings > General > About > Diagnostics & Usage will allow you to choose between Automatically Send and Don't Send.
iOS 4 and earlier By default, opting in is a one-time decision. If you'd like to change your decision, you can reset warnings for your iOS 4 or earlier device so that you will be asked again.
How to reset warnings within iTunes Connect your iPad, iPhone, or iPod touch to your PC or Mac. Wait until your device has appeared on the left side of the iTunes window under Devices. Right-click (Mac or PC) or Control-click (Mac) the icon for your device. From the shortcut menu, choose Reset Warnings:
The next time you sync after resetting warnings, you should see:
To disagree and stop sending Apple diagnostic and usage information, click No Thanks.
If you don't see the window above Disconnect your device from your computer. Open an application on your device. Press and hold the Sleep/Wake button until the red slider appears, and then press and hold the Home button until the application quits. If you're using iOS 2.x or earlier, press and hold the Home button until the application quits. Connect your device and sync it with iTunes. The option to agree or disagree to diagnostics collection should appear again.
Chearz;)

iPhone console for nslog?

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.

error from debugger: the program being debugged is not being run

i have run my application in device but application is crashed and print following message
error from debugger: the program being debugged is not being run.
so please tell me what to do?
my application gonna launch properly but not not debugging first time (gonna crash) than from second time i start application work proper without crashing
my application install in device. we can`t debug in device...
The first thing i do when i get that is a Clean All usually solves that. If you don't see the Clean All button right click your Xcode toolbar, customize, and drag the Clean All button to your toolbar from there.
-Check that the provisioning profile installed on your device haven't expired (would see a red dot in the organizer - Window->Organizer).
-Try restarting XCode.
Do you mean device? If so then it could mean the device is not launching the application correctly. Make sure your developer profile and everything in the build settings is correctly set. This may sound obvious but also make sure the device is unlocked and open.

App crashed in Beta on the device, but not in debug

I've created a Beta ad hoc delivery profile, and when I press 'build and run' on the device in beta mode, my app crashes after I press a button.
However, when I use the app in debug mode (on the device) it works fine. It also works fine in the simulator and on the device in beta mode (when it's not connected to XCode)
Any ideas what's up here? It doesn't bother me too much since I can debug in debug mode...but I'm wondering when it comes to the submission process, if this will be a problem?
Thanks!
EDIT: Would this happen to be because I've got an entitlements file (dist.plist) with the option 'get-task-allow' unchecked? I tried checking this box but got an error "The executable was signed with invalid arguments"
There are many areas that can be the culprit. You may have an #if or #ifdef DEBUG, or you could have (more likely) some source or xib that is not included in the Beta Target.
You should be looking in the log, whether during its run via Xcode or after when you plug the device back into your Mac and look at the log file using the Organizer window, for more details of the crash. If it is related to clicking on a button, look at the path between the the button's actions set in the xib and the selector in your code. Sprinkle some NSLogs in there to help you out.
I have experienced this with applications that interact with other systems where timing is critical and debug mode affects the timing of the interaction with the other systems. Specifically when screen scraping an IBM mainframe but any time critical application may experience this.