Debugging in Appcelerator Titanium
I’m working on a new project for iOS, and instead of using Objective-C, I decided to use Appcelerator Titanium again to help speed up development— even though I said I would never use it again.
A long time ago (in the iPad 1 days), I used Appcelerator to build an app called LOL. The problem was, there was a huge memory leak caused by a bug in the framework. Images were not properly released, resulting in a pile up of memory. This was a huge issue because of the 256mb of RAM the iPad 1 had. I published the app after fixing some of the bugs in the framework myself, but there were still issues. I ended up rewriting the entire app natively in Objective-C.
Some two years later, I am back to iOS development. While I did work on a Mac OS X app between “LOL” and now, my Objective-C is rusty, and a lot has changed in the newest versions of iOS. Automatic reference counting (ARC) now solves my worst nightmare for me. Rather than relearn Objective-C, I opted to once again use Appcelerator.
While the memory leak present in the 1.x versions of the framework is long gone, I still find that using Appcelerator is a hassle— especially when debugging. I get useless error messages, like
Parse error: unknown file. What does that mean, and what is this “unknown file”?
Logically, I checked to see if I had started referencing any new files since I last built the app. I had— I added a new module to the project. As far as I knew, I had added it correctly.
Next, I did some Googling, until I found this article. Someone mentioned that this error sometimes occurs when there is a syntax error. If this were true, the first part of the error makes perfect sense— there was a problem parsing something because I had a syntax error. But “unknown file”? Really? That isn’t even close, or helpful in solving the problem.
Appcelerator really needs to fix their error messages and show a line number, as well as a more descriptive message. Not one that describes the problem from the framework’s point of view, but from the developer’s.