I have been coding away on phase two of our application for the iPhone. Lots of SQLite work and ton of new code. I just began testing on the actual device this week. Much easier and faster to test in the simulator as you must type in a password to login in every time you run the program and that gets old on the device keyboard.
I ran the program on our month old iTouch rev 3 device and not a single UIAlertView would appear. WTF? I did a simple test app, no go. I put the same program on our original iTouch rev 2 and it worked without a hitch. It has an older iOS version as Apple discontinued iOS releases for that hardware. Could it be iOS 4.3.2? After searching the web I found nothing to indicate that is an iOS version issue.
Next thought was to test it on another device with same iOS version. I went in search of an iPhone that is provisioned but after checking iOS version not being 4.3.2 the owner suggested I do a factor reset on the iTouch and see what happens. Nothing on the iTouch but the one program I test so that was not a big deal. Post reset and everything appears to be working fine. My UIAlertViews show up.
To me this rather worrisome. Here is a device that is a couple of months old at max. Has had exactly one iOS update installed and has no extra apps, no music, no videos, etc. on it. Basically a blank slate with just the one program I run and the SQLite databases I have created. After a month of use a very standard API call is totally screwed and I get to do a full factory reset to get it back to life. Now every time something works in the simulator but not on the device I am going to factory reset the stupid thing. Not something I want to tell clients to do. Seems like iPod users just accept this as a fact of life. Apple - it just works - unless it doesn't then factory reset it!
Not that Microsoft and Windows is immune to any of this. I have a Microsoft mouse on my Win7 machine. It gets lost every time the machine goes to sleep then I wake it up. I have to unplug the mouse and plug it back in again to get it to not just jump all over the screen. Web searches show this to be a known issue with a freaking MS mouse! They had a solution of not letting the USB connection being used go to sleep but that did not solve it for me.
Today I gave up and plugged the Dell mouse I was using on the Macbook into my desktop and plugged the MS mouse into the Mac - partially for the irony of it all. Hopefully I can stop the unplug fun on the desktop and the Mac seems to accept the stupid MS mouse. I like the MS mouse better as far as hand fit goes so I will miss it on my main machine when I go back to coding on the Android side.
As far as SQLite goes it seems to work rather nicely. I have a dozen tables with some of them having 17k records. Initially loading the big tables took 26 seconds in the simulator and over 5 minutes on the device. Man you really have to run on the device to check your work! I was not wrapping my loading loop with a begin transaction / commit. After I did that the simulator went to 0.30 seconds and the device to 4.30 seconds. Still a massive time difference but 4.30 seconds is not bad for a table that only updates yearly. It is used for code to text description lookups.
I am using FMDatabase to help out with the SQLite interaction. I implemented some ideas from the Android SQLite wrapper on the iOS side. Things like keeping an over all DB schema version in the PRAGMA user_version of the database. I have helper methods in my main DBTable object to help me create the INSERT and UPDATE strings and all tables are defined by an array of column mappings. Almost all SQL instructions are generated via code. Next I need to put captured pictures into the table as blobs.
Xcode is being used as my main IDE again. JetBrain's AppCode was just not cutting it as I was in Interface Builder a lot and it doesn't provide enough info on program crashes as of yet.
Speaking of crashes, I had a memory crash and went crazy trying to find it. I finally held down ALT and got the "Run..." in the menu and set the special memory options to show decent results. Ran slow but pointed me exactly to the memory area which was nowhere near an object I was blaming. I am using a multi-colored label as my table cell view. I was releasing some memory that I should not have in its dealloc. I still don't fully understand the iOS memory model. I only saw the crash after bringing up the view where you search and pick from one of the big DB tables then you rotate the device. Guess it was doing some garbage collection at that point and the double release annoyed it.
I am slowly learning various memory debugging techniques, how to use NSZombieEnabled and how to use the memory leak detector. All of it is a bit obscure but does the job in the end.
No comments:
Post a Comment