Page 1 of 1

4.2.0 DB Popup crashing bug: Possible Workarounds

PostPosted: Fri Jul 03, 2009 9:17 am
by dhaupert
Hi all,

I've been hearing from a lot of people regarding the bug with the combination of iPhone 3.0 and HanDBase 4.2.0. It's a particularly painful one if you were using DB Popups for your billing codes, for example, as it was integral to your daily routine. I have responded to one user in particular and wanted to include my tips here in case they apply to any of you:

I'm so sorry you're having to deal with this bug. There are some possible workarounds, but it may or may not work in terms of practicality. I'll go over the choices you have here but first some background on the nature of the bug:

The bug itself stems from the iPhone trying to redraw the selected item on the List View screen even after we closed the database and the list view screen itself, and are returning to the edit record screen with the DB Popup values in tow. Prior to iPhone 3.0, this did not happen, when you closed the screen, you were safe to free the memory of the database and such because it was not going to redraw. But Apple did not want records to stay highlighted in a table, so they are expressely trying to redraw the selected record as unhighlighted. So what happens is that since the DB Popup database which may have had hundreds or thousands of records and for example, was currently set to show records 560-569 based on where you were in the DB Popup screen was trying to reference those records in now the database that is open, the parent one that had the DB Popup field in it. That database may only have 50 records, but because this is a redraw, we already had assumed that 560-569 existed and thus the pointers in memory were set. So it crashes because the pointers are invalid.

Possible Workarounds:

1. The above may make no sense to you, and that's OK- it's a bit of techno-babble if you're not a programmer! But what it means is that if the database with the DB Popup field itself had records 560-569 (in that example) the crash wouldn't happen. That's why if you select a DB Popup near the top of the list it often doesn't crash (and hence why it got through our testing!). So the workaround effectively is to make sure that you have the same number (or more) records in your main database (the one with the db popup) as you do in the database that the DB Popup field points to. Creating several hundred dummy records could be as easy as repeatedly pushing the + button in the Edit Record screen, but that may or may not be something you want to do- as you'll then have to delete all those once 4.2.1 is approved.

2. Another workaround is to use the Copy and Paste feature of iPhone 3.0 to copy these values for the time being. You can set up a relationship field from the top database to the DB popup database that shows all records. This would mean perhaps adding a text field on each database and setting the values the same for all records. This way all records in the top database and the DB Popup database have the same values for these text fields. Then you set up a relationship field in the top database to point the two text fields at each other. Now when in the top database, you can select the Relationship field, which acts as a jump to the related DB Popup database. Find the record you desire and then open it for editing. Using the copy feature of iPhone 3.0, you can copy the value you desire to the clipboard. Now cancel the record save and choose the Back button up top. This should return to the edit record screen of the top database, where you can paste your value into the DB Popup field.

3. Another potential workaround is to go back to 4.1.1- I have no idea why 4.1.1 works on iPhone 3.0 as this relevant code is still the same. My thought is that because it was compiled using an older version of the SDK it behaves differently in this regard. Because Apple signs each application to run on your device as you download it from the app store, we don't have a version of 4.1.1 that works for you. But you may indeed have it. If you haven't synced to your desktop since installing 4.2.0, your desktop still has 4.1.1 backed up on it. Before you do connect it to your computer, you could use the HanDBase iPhone conduit or Desktop Connect, back up all databases and then delete HanDBase from the device. Then on the sync, you can check the HanDBase icon in the applications tab in iTunes and it should restore 4.1.1 to your device. Then you can sync again and restore the databases to the iPhone. Once 4.2.1 comes out, you can then switch to that version.

4. The last potential workaround involves in going back to iPhone OS 2.2.1. In the iTunes screen, there is an option to restore it to an older version. You'd first need to back everything up as above and then restore to the older iPhone OS. Then you can install HandBase 4.2.0 and your databases back and it should work without these crashing issues.

Again my apologies for the issue- I wish we had caught these back in May when the 4.2.0 was submitted, but we had no idea it would take 3 weeks for Apple to approve it and by then iPhone 3.0 was changed several times and out the door to customers!