Reputation: 673
When i delete cell from table view:This error is occur:
Program received signal: “EXC_BAD_ACCESS”.
warning: Unable to read symbols for /Xcode3.2.5/Platforms/iPhoneOS.platform/DeviceSupport/4.3.2 (8H7)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found).
Here i delete object from cell and its event from calander:
if (editingStyle == UITableViewCellEditingStyleDelete)
{
//Get the object to delete from the array.
lovkid *mykids = (lovkid *)[appDelegate.actionarray1 objectAtIndex:indexPath.row];
appDelegate.actionId = mykids.Id;
//delete from calender
if( [ mykids.Event isEqualToString:@"empty"])
{
}
else
{
EKEvent* event2 = [appDelegate.eventStore eventWithIdentifier:mykids.Event];
if (event2 != nil)
{
NSError* error = nil;
[appDelegate.eventStore removeEvent:event2 span:EKSpanThisEvent error:&error];
}
}
//delete end
[mykids deleteAction];
[appDelegate.actionarray1 removeObjectAtIndex:indexPath.row];
//Delete the object from the table.
[localTable deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
[localTable reloadData];
a = 0;
}
else
{
//NSLog(@"test");
}
Delete from db:
deleteStmt1 = nil;
if(deleteStmt1 == nil)
{
const char *sql = "delete from actions where id = ?";
if(sqlite3_prepare_v2(database1, sql, -1, &deleteStmt1, NULL) != SQLITE_OK)
NSAssert1(0, @"Error while creating delete statement. '%s'", sqlite3_errmsg(database1));
//When binding parameters, index starts from 1 and not zero.
sqlite3_bind_int(deleteStmt1, 1,(int)appDelegate.actionId);
if (SQLITE_DONE != sqlite3_step(deleteStmt1))
NSAssert1(0, @"Error while deleting. '%s'", sqlite3_errmsg(database1));
sqlite3_reset(deleteStmt1);
sqlite3_finalize(deleteStmt1);
}
What is the reason behing this error?
Upvotes: 0
Views: 832
Reputation: 69027
I would suggest removing the line:
[localTable deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
If you are reloading the table by reloadData
, it is not necessary to remove the row that way. The table will be reloaded reflecting the new data source state.
On the other hand, you could investigate beginUpdates
and endUpdates
if you are up to a smoother refresh of your table. In that case it makes sense using deleteRowsAtIndexPaths
.
I don't know if this will solve your crash. In case it does not, I suggest you execute under the debugger so you can find out exactly which is the offending statement causing the crash.
Upvotes: 1