I have created two tables(vcards, viewdownloads) in sqlite3 database in iOS. At the beginning of my app starts Iam inserting my address book contacts to the sqlite3 database in to "vcards" table using background process.
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
[self setNotificationForReachability];
dispatch_queue_t loadQueue = dispatch_queue_create("Image loader", NULL);
dispatch_async(loadQueue, ^{
// Your code to run in the background here
GVDBManager *objDB = [GVDBManager getSharedInstance];
[objDB getContactsFromAddBook];
[objDB syncPhoneBookWithVcardsTable];
});
}
in the middle of this process of inserting contacts into "vcards" table, I have called the another background process to update some values using update query in same "vcards" table
after this process completion again Iam calling one more background process to insert the some contacts to the "viewdownloads" table and displaying the contacts using UI. my questions: 1.After click on one button, Reading the contacts from database and this is taking some time to load into array(aim reading 800 contacts). Iam using background process to do this. 2.Every time iam opening the database and closing it while inserting and updating the tables using background process.This causes my app crash and this is the major issue iam facing. can any explain clearly how to handle multiple actions(inserting, updating and searching) on same database. thanks in Advance.
