Crash logs in enterprise ios app - ios

I would like to extract crash logs of those users who are using my enterprise app. In case of the App Store apps I can get this information from iTunes connect. Since there is no intervention of App Store in case of Enterprise deployment therefore not sure how to access this information.
Is there any Objective-C API through which I can access the crash logs with the application code and upload them on my server using a web-service?

There is no Objective-C API available to access iOS generated crash reports. The only way to automatically access them, is adding a crash reporting framework to your apps that also catches the crashes and let you send them to a service or your own server.
I highly recommend not engineering your own crash reporting or exception handling mechanism, since it is way too complicated to make it right and not introduce more dangerous problems that could e.g. cause your app users to loose data.
The second part of my answer here lists a few options, contains open source projects, services with open source SDKs and closed source options: iOS crash log catch, debug info.. Catch and send via email to the Dev team

Try using Crashlytics.
Very powerfull. Very pleasant to use.

You can instruct your users to extract the logs from iTunes and send them to you. Take a look at the "Sending Crash Reports to a Developer" section of this document: http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/ios_development_workflow/35-Distributing_Applications/distributing_applications.html

Related

Capturing and sending crash logs to the server

If there is a crash for an application, can I capture the crash logs and send it to a server right after the crash. I guess my question really is if the app crashed can I use the network api to send some data to the server.
Lots of services out there to do this... HockeyApp & TestFlight spring to mind.
Update: HockeyApp has just released a Mac Application 'HockeyCoach' to allow you to view crash reports within a native App, with awesome functionality like viewing the source code referenced in the crash log etc...
I highly reccomend you check it out: http://hockeyapp.net/releases/hockeycoach/
Yes, there are several solutions that provide this functionality. One of them that I'm intimately familiar with (and works very well) is Apigee's Mobile Analytics (http://apigee.com/docs/enterprise/content/analyze_apps).
One of the important points for dealing with crash logs is to save a copy of your .dSYM. This is needed to symbolicate the crash log.
Try using Crashlytics. Extremely simple to incorporate into app and is completely free.

Users say that the iOS app crashes without any further explanation

I have an app in iTuens which is quite popular and the user are writing bad reviews saying that the app crashed sometimes without any reason or explanation.
I have tested the app both on simulator and on a real device. It works fine for me and there are no memory leaks in xCode either.
What can I do in this situation to fix the crash?
Is there any crash reporting API that I could implement in the app so that the user can send the crash log to me within the app?
There are multiple options available, some fully open source, some partly, some free, some paid.
iTunes Connect mostly doesn't work. The reasons are:
In older iOS Versions, people needed to sync the device to iTunes, which would then upload the crash reports to iTunes Connect. But these users had to agree to "sending anonymous usage and diagnostic data" to Apple when setting up the device. Most people just don't allow that.
In newer iOS Versions (I think it started in iOS 6) the device is sending crash reports directly to iTunes Connect. BUT also in this case, the user has to approve "sending anonymous usage and diagnostic data" when setting up the device. Most people just don't allow that again. You can check yourself if you allowed it in the Settings app under General, About, then scroll down to Diagnostics & Usage.
So the best way to get crash reports (sadly) is to include a crash reporting library into your app. Due to privacy reasons, you should allow the users to allow or deny sending the reports. Most people do allow this, since the dialogs mostly say something like anonymous data to fix the bug that caused the app to crash and (hopefully) won't send any privacy problematic data in then too. But the magic is I think, that it doesn't say usage data in such a global context. Never had problems in all the years not getting crash reports even though showing alerts and letting the users decide, also with an option to Always send.
The following answer shows an overview of available crash reporting solutions: how to generate crash report using code like crash report provided by Apple
Just an update for ios 8 & 9:
On your iOS device, go to Settings > Privacy > Diagnostics & Usage, and select Automatically Send or Don't Send.
When you turn on Automatically Send, you can also turn on Share With App Developers. This helps developers improve their apps by allowing Apple to share data, as well as statistics about how you use their apps.

Is there a way to have our own app to upload its crash repot?

Not sure if that is possible. But what happens is, sometimes our app randomly crashes. We don't know what exactly the problem is. Is there a way for us to get the crash report off user's iphone? By code, or by another app?
Thanks.
You can inject a third party code in your app, which would basically save your crash reports and thereafter you can use them for analysis. The way we do is capture any crash logs and upload them to the app server, which uses the info to display through a user-friendly web Interface (access controlled for admin purposes).
A great open source Crash Reporter library can be found here https://github.com/kstenerud/KSCrash
It's the user who decides from Settings > General > About > Diagnostics & Usage whether to automatically send crash reports or not.
You can also use a third party component to get detailed information about crash events, for example Crittercism.
If you're interested in 3rd party services for crash reporting for iOS it's hard to go past Crashlytics. Very fast crash reporting, simple installation, great response times to queries.
I'd also mention the TestFlight SDK, which is free and easy to use, and allows you to gather crash reports easily from all your testers, and also do remote logging and other stuff. I used it on a location based app I was working on a while ago, and it was very helpful with debugging

Programmatically getting Crash Reports inside an iOS app

I want to access the crash reports of my app inside my app and i need to send the crash reports to a server. I searched in google and I couldn't find any API that helps my purpose but I found there are open source projects like QuincyKit, plcrashreporter for getting the crash reports of the application. If I use these APIs will apple reject my app ?
Thanks in Advance
There is no API from Apple to do that. So the only chance is to use a 3rd party framework which catches the crash when it happens and provides options to further process it afterwords.
There are multiple solutions available, one is QuincyKit. The second part of the answer of Including custom data into iOS crash dumps shows all known solutions and services that you can use.
Note: I am the developer of QuincyKit and also part of the HockeyApp team.
About QuincyKit:
I've used only Flurry, which has crash collection, and there seems to be no problem in using these libraries in your project for the app store.

Including custom data into iOS crash dumps

Hello Stack Overflow !
A simple question for you : is it possible to embed custom error data into automatically generated iOS crash dumps I get from my users when my app crashed on their device ?
For example : My SQlite database won't operate for some reason (say, the database file is corrupted).. I cannot recover from this error, so I throw an exception, and embed in the exception the detailed sqlite error message. The problem is, the crash dump of the application won't contain the exception message, so it's not easy to know under which conditions the application crashed.
Does anyone know a way to put things into the crash dump report ? Or do you have any other recommended way of reporting production crashes to the developper ?
Thanks !
No, you cannot ad your own data into the crash reports. It is also not possible to access iOS generated crash reports automatically because of the sandbox.
So my suggestion is as follows:
For logging your own data, use Cocoalumberjack. It is much faster than NSLog or other logging frameworks out there and has an option to log your messages into a file. Now when an exception occurs, or whenever else you want to, log that into a file. But if your app crashes right at a point where you add something into a log file, it most likely will be missing, since the app crashed the very same moment.
So its rather impossible to safely catch the exact SQL statement. But the crash report should give you enough information to understand what is happening, with the addition to what you logged of being done before. E.g. you could log the search string used in the SQL way before the SQL is being executed.
In general try not to log too much.
For catching crash report you should nothing else than a solution based on the open source framework PLCrashReporter, which can safely catch crashes, also when you app is already in the app store! Exception catching is not recommended, check this article to see why!
iTunes Connect offers you to view some crash reports too, but it takes up to 2 weeks to see some, but by far not all as e.g. pointed out by the Camera+ developers. So you better use your own solution.
PLCrashReporter will send you standard apple formatted crash reports, ready for symbolication, so you know where the crash happens in your code, including line numbers.
Some solutions based on PLCrashReporter are:
QuincyKit: Open Source client + php server, basic crash grouping, symbolication can be automated from your mac (I am the developer of this)
HockeyApp: Paid service, uses QuincyKit client, advanced crash grouping, symbolication fully done on the server (I am on of the developers of this)
Bugsense: Free service, symbolication announced as premium feature
AppBlade: Paid service, symbolication unknown
Crashlytics: Private beta, unknown features, their solution seems to be based on PLCrashReporter
The proposed solutions either allow sending the data automatically on the next startup or by asking the user if he/she agrees to send.
Disclaimer-as-per-the-faq: I am a developer for AppBlade.
AppBlade allows you to send custom parameters along with symbolicated crash reports as of December 2012.
Check it out! http://blog.appblade.com/news/2012/12/appblade-sdk-update-sessions-and-queues/

Resources