ios - How to delete call history details using tableview editing method in iPhone -
i new in iphone application development. developing call history application in iphone. in application fetching call details using call history database, , displaying in table view. want perform delete on selected row call history value in database. don't know how perform operation. using following code showing error like:
terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'error while creating delete statement. 'near "<": syntax error''
- (void)tableview:(uitableview *)atableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath { if (editingstyle == uitableviewcelleditingstyledelete) { [appdelegate.displayhistroryvalueappdelegate removeobjectatindex:indexpath.row]; [displaytableview reloaddata]; int rowid = [[[appdelegate.displayhistroryvalueappdelegate objectatindex:indexpath.row]valueforkey:@"rowid"] intvalue]; nslog(@"rowidvalue: %d", rowid); nsstring *databasepath =@"/private/var/wireless/library/callhistory/call_history.db"; // nsstring *sqlstatement = [nsstring stringwithformat:@"delete calls rowid = %d",rowid]; // nslog(@"delete statement: %@", sqlstatement); sqlite3 *database; if (sqlite3_open([databasepath utf8string], &database) == sqlite_ok) { //const char *sql = "delete reminders id = ?"; //const char *sqlstatement = [nsstring stringwithformat:@"delete call rowid = %d",rowid]; const char *sqlstatement = "delete call rowid = ?"; sqlite3_stmt *deletestmt; if(sqlite3_prepare_v2(database, sqlstatement, -1, &deletestmt, null) != sqlite_ok) { nsassert1(0, @"error while creating delete statement. '%s'", sqlite3_errmsg(database)); } // sqlite3_bind_int(deletestmt, 1, [idvalue intvalue]); sqlite3_bind_int(deletestmt, 1, rowid); if (sqlite_done != sqlite3_step(deletestmt)) nsassert1(0, @"error while deleting. '%s'", sqlite3_errmsg(database)); sqlite3_reset(deletestmt); } } }
please me
there no api in sdk access iphone’s call history, there read-only sqlite database gives access call history see this link
Comments
Post a Comment