Swizzling TiExceptionHandler to better capture issues within Appcelerator Titanium IOS Applications - Clearly Innovative | Web and Mobile DevelopmentClearly Innovative | Web and Mobile Development

So in my IOS hacking adventures and attempts to get better log information for apps running in production, I looked into the bowels of the source code of Appcelerator Titanium. I was looking for a way to make my logging the eyes and ears of the app once it is in the wild so we can better support our applications and see what is going on when the app is not running in the IOS Simulator or in the debugger.

First I found this interesting javascript library stacktrace.js to provide more information in my javascript files when an errror does occur… then starting looking into TiExceptionHandler since that is where the magic really happens. All this lead me to MethodSwizzling where I attempted to have my IOS module’s methods called when exceptions were reported in my app so I can capture the information.

This approach is not complete or thoroughly tested, but I am able to get  my module’s methods called when script errors occur in the application and when exception are thrown in the application. I wanted to put this out there to see if anyone else has gone down this path or could provide another set of eyes to validate the overall approach.

This is a few hours of hacking nothing perfect, but take a look and share your thoughts