Problem: Dive info becomes incorrect upon sync w/ iphone

Discussions about the smartphone versions
Post Reply
JWS
Posts: 1
Joined: Fri Apr 24, 2009 23:36

Problem: Dive info becomes incorrect upon sync w/ iphone

Post by JWS »

I love the iphone app, still getting used to the desktop program. I am having a problem with dive information changing when dives are recieved from and sent to my iphone. both the app and desktop program are new to me so i figured i would log 6 dives on my phone to see how it all worked. before any kind of syncing, i added some custom dive activities/types and deleted others on the iphone app. I also added some countries, dive sites, and cities, as well as some equipment and other misc info. so on to the problem....
-synced with desktop program(brand new logbook with no info) and the activites were not matched with the ones i had checked on the phone they were all over the place, everything else seemed to be ok
-(without making changes) synced this logbook back to the iphone and then nothing matched at all, sites were in wrong countries and cities activities were incorrect, dive numbers were changed and reordered.

has anyone else had this problem? I think this would be a great combo of programs if I could find away around this. thanks for any info.
divinglog
Site Admin
Posts: 5768
Joined: Sat Feb 08, 2003 21:02
Location: Coburg
Contact:

Re: Problem: Dive info becomes incorrect upon sync w/ iphone

Post by divinglog »

Hi

This problem is related to the internal IDs of the items. I'm aware of this issue and try to find a solution for it, but it is not so easy. I'll try to explain the datails: This could happen when you do a lot of modifications on the iPhone and when you have never synced this logbook before to the desktop. The problem mainly happens when you delete items on the iPhone which are not yet synced to the desktop.

For example you have 3 items (internal ID 1, 2 and 3) on the iPhone and delete the 2nd item. None of these items were in the desktop logbook before. Then you sync the first time to the desktop, and 2 items were created (because you deleted the 2nd item), but these items get the ID 1 and 2. But on the iPhone the 3rd item has the ID 3.

To avoid this, I recommend that you start from the desktop side in the beginning, then sync to the iPhone. Then you can do modifications on the iPhone and sync these back to the desktop. I have to do some modifications in the desktop logbook database to avoid this problem in future.

Kind regards,
Sven
gregm
Posts: 63
Joined: Tue Jan 06, 2009 23:04
Location: Bellingham, WA, USA
Contact:

Re: Problem: Dive info becomes incorrect upon sync w/ iphone

Post by gregm »

I just wanted to add a little information to Sven's response to this issue.

The first issue in the original post is fully explained by the problem that Sven outlined. Regarding the second issue (syncing back to the iPhone), I'll need to try some experiments to see if I can reproduce the problem. When syncing back to the iPhone, the logbook should look identical to the logbook on the desktop. The reason for this is that Diving Log 4.0 creates an entirely new logbook file that is copied onto the iPhone that is based only on the data in it's database file. The existing logbook file on the iPhone is not used in this direction and is completely replaced once the user taps the "Use new Logbook" button on the iPhone. This has caused some confusion in the past as it is not the normal pattern for bidirectional syncing. The choice to do it this way was made for a number of reasons having to do with battery life of the iPhone and consistency when external events (like a phone call) interrupt the process. If you makes changes on the iPhone that have not been transfered to the desktop, you must first sync from the iPhone to the desktop and then sync back to the iPhone if you want to preserve those changes. In the case that you only make changes to the desktop since the last sync you do not need to first sync the iPhone changes. So unless changes were made on the iPhone before the sync of the unchanged file from the desktop (which does not appear to be the case here), things like dive numbers and the order of the dives should definitely not have changed. Errors that occurred as a result of the issue that Sven described will, of course, be present. I will investigate this further and post back.

On the first issue (sync from iPhone to the desktop and having things like Dive Type or City change), there are some additional things you can do to avoid this problem. The issue, as Sven said, is caused by the way that various items in the database are linked together. The underlying database on the iPhone and the desktop are different (SQLite on the iPhone and Microsoft Access on the desktop) so, in the case of a sync from the iPhone to the desktop, items need to be copied from the SQLite database to the Access database if they have changed or been added (and deleted if they no longer exist). When an existing record is changed there is no problem as the two records can be explicitly matched using an internal identifier that is absolutely unique. The issue arises only when an entry is added on the iPhone and deleted before a sync to the desktop happens. In this case, the desktop knows nothing about this record ever having existed. Due to a limitation in the way that internal ID's are created in Access, there is no way to maintain the gap. The eventual solution will likely involve rewriting all the records that count on that ID (and subsequent IDs) that is now wrong as this is clearly a bug. In the mean time, you can avoid this problem in a couple of ways.

As Sven mentioned, starting your logbook's life on the desktop will help. The other thing that you can do is to sync your logbook on the iPhone with Diving Log immediately (before doing any edits on the iPhone ... I would even go so far as to sync the sample logbook before you delete the sample dive). You should then be able to then edit the items on the iPhone and future sync should work fine. No matter how you start your logbook, you should keep the following point in mind. If you create an item on the iPhone, you should always sync with the desktop before you delete that item. Instead of deleting an item that you are not going to use, you can edit that item to be the one you want (say you added a Dive Type of "Fon" and meant "Fun", edit the Dive Type rather than deleting the wrong one and creating the new one).

Hopefully this will be an uncommon problem for you once you get going with your logbook. Following the tips above should work around the problem until we can address it.

Best Regards,

Greg

Greg McLaughlin
More Mobile Software
Post Reply