See the Mac Console for full error details

By | January 10, 2013

Simulator errorI got a (probably not so) bright idea about how to do a bulk update of my app’s database as part of a version upgrade. I could generate a SQL file containing all the statements that needed to be run by exporting from my desktop DB tool. Then I’d package the file with my app upgrade, read it from the file system, pass it to dbconn.execute() and boom, updated database. Well, not so fast. You see, I got the error you see at the right.

Unfortunately, the error message extends of the top of the screen and the Studio console messages didn’t help much either. See below.


Studio console

Here’s where the difference between a simulator and emulator comes in handy. The “iOS simulator” means that your code actually runs on your OS X computer as an OS X process. We can get info and output from the simulator via the operating system’s tools. I opened up the Console (Applications, Utilities, Console) and was able to find this:

Mac Console

Ah, I was trying to pass multiple SQL statements in a single SQL query, something SQLite doesn’t like. I can fix that, now that I know what I’m fixing.

Back to the simulator/emulator difference, the “Android emulator” means your app code runs inside a virtual computer which is running on your desktop. You can’t use operating system tools (like Mac Console) to peek inside. You’ll have to turn to dedicated platform debugging tools. The point of the post is not that one is better/worse, just that there is a difference. (Oh, and using the Console is pretty darned handy when error messages are truncated.)