Capturing and sending crash logs to the server - ios

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.

Related

Returning errors back to development team from deployed iOS application

Long time ASP.Net developer, first time iOS app developer here. I am writing an iPhone app at present and I would like to know how best to notify myself when the app experiences a fault out in deployment.
What do people do currently? Do you return the error codes back to a server periodically? Does Apple have a special tool that I am yet to hear about?
with ASP.Net it is relatively easy as it is server based technology, thus most errors are experienced on the server and the server can record this information. With iOS applications the error is experienced on the device and I am concerned that I may end up with an error that repeatedly occurs but my users either do not tell me about or I cannot reproduce.
Thank you for your help.
Depends on what kind of errors you're talking about...
Exceptions are automatically reported back by Apple. But, they don't give all exceptions back and there is a lag. There are several 3rd party services which you can use where you add their framework and it will detect the exception and send it back to their server for you to analyse.
For non-exception errors there is nothing standard. I would suggest adding analytics to your app and using part of the analytics to track these occurrences.
Some of the crashes can be recorded using crashlytics framework or using hockey app so that you will get notified and also you can integrate Google Analytics into your iOS application to find out the number of crashes and in particular in which screen they are occurred.

Generating crash reports on Cocoa Touch apps

That probably sounds a lot worse than it is, but here's my question.
I am dealing with a crash on an actual device, that one of my tester's is using. At the moment, there is no way to discover what is causing the crash. I can not reproduce it on the simulator. However, on the simulator when something crashes I get log info about it in the output window. But I don't want to keep testing with the device connected.
Is it possible to log crash exceptions, etc into a file when things crash. I know certain apps can do it, but I am not sure how?
Any info would be appreciated.
There are generally two ways to do that:
Someone get the tester to send you the crash reports, that iOS created on the device. This is usually too tricky for end users, so the next suggestion works better. That's also why I am not describing how to do that :) But you'll find plenty of documentations on that process.
Integrate a crash reporting library, that catches the crashes and allows you to receive them in various ways. You should not implement your own global crash exception handler, things are just too complex to do it right (even though other people will tell you otherwise). Also crashes caused by exceptions are only one type of crashes.
There are multiple open source libraries out there, the safest one to use is anything based on PLCrashReporter. Most others use private or undocumented iOS APIs, or are not async-safe, which basically means those can destroy app data or make the crash even worse. See this blog post about the topic: http://landonf.bikemonkey.org/code/crashreporting/Reliable_Crash_Reporting_1.1.20130119.html
The following linked answer shows some of the available options on how to add logging to your app and also various options on how to receive crash reports for test version and also once the app is released: Including custom data into iOS crash dumps
If you're open to using a third party service, I use https://www.crashlytics.com. Makes debugging crashes from user devices painless.

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

Crash logs in enterprise ios app

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

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.

Resources