jeudi 28 mai 2015

adding a record to SQLite cause extra random records to be added

I am writing an application with iOS and SQLite database. I have a tableView that displays a list of workshops with information i.e:Title, presenters' names. when the user clicks Add button a new view is presented modally. the new view contains a list of names. The user can choose the workshop presenters by tabbing on some names from this list, and then the selected name get a checkmark besides them. after user clicks save the records are added to the Database correctly and the view is dismissed. However, after I return to the view with the list of workshops I find that the newly added workshop has more presenters than I actually added. When I check the database file I find that the extra records are actually added in the database which means that it is not a semantic error in the code that causes the extra names to be added. Also, I debugged my code where the insert query is placed. It explicitly states that only the checked names are added to the database, and I NSLog the result of the query, it prints out the selected names only. I don't know where exactly the extra names are added. I tried to find a pattern but every time different names are being added as extra in the database. The odd thing is that this problem does not occur always.

Aucun commentaire:

Enregistrer un commentaire