Capturing native exceptions in Cordova/PhoneGap - ios

I've got a Cordova/PhoneGap + JQueryMobile application running on iOS and a few customers are reporting that the app is just "vanishing" on them during certain interaction points.
Unfortunately I'm not able to reproduce it, so I'm kind of stuck. I'm wagering that the app is running out of memory or maybe hitting some other kind of iOS level exception.
What I'm wondering is this - does anyone have any suggestions on a good way to capture native exceptions in PhoneGap and either log them or trigger a crash report that the user can email to us? Until we can see what the crash is being triggered by, there is no hope of fixing it.

Related

What's the life cycle of iOS app on an app crash?

I'm trying to log a time before the app gets terminated and it seems to behave differently on an app crash so the time never gets logged. NSSetUncaughtExceptionHandler is a potential solution but I'm finding that it's not recommended if we're already using other 3rd party frameworks like crashlytics / fabric. Can anyone suggest the proper approach to solving this problem?

iOS Google Analytics Crash report

Does anyone know when GoogleAnalytics iOS SDK v3 sends the crash to their servers (when app is on AppStore)?
Does it send when the app crashes, or when the user reopens it?
The problem is that, I'm viewing a lot of crashes from a bug that I think I solved, and on HockeyApp I'm not receiving anymore of these.
Thanks
Some points:
Crash reports are usually send the next time the app starts. Trying to send them at crash time may cause big harm to an app and its data. As far as I know GoogleAnalytics only sends reports on the next startup.
Google Analytics can only catch crashes caused by exceptions! In addition, any other exception handler will NOT be able to catch the exception! This is why you only see reports in Google Analytics but not in HockeyApp. This will happen with any other 3rd party SDK too. Usually the last crash reporting SDK you setup in your app wins.
You can test this yourself by using the CrashProbe open source project and include the SDK or SDKs you want to use. And then monitor the behavior for various crash types.
From my personal experience, Google Analytics is not good in capturing crash report as I think the crash report might not be real time . Personally, I like bugsense and I am using paid version of Bugsense. Its free version is good for most apps as well. May be you can try out the free version.

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.

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.

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

Resources