hi experts,
I have a simple todo list embedded in my main app, I had established it in a separate project, then I add it to my main project carefully, everything is good but, when I write the todo and click save button the program is crash! what is the problem?
my code:
self.navigationItem.rightBarButtonItem =
[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave
target:self
action:@selector(save_Clicked:)]
autorelease];
then the save_Clicked implementation is :
- (void) save_Clicked:(id)sender {
HomeAppDelegate *appDelegate =
(HomeAppDelegate *)[[UIApplication sharedApplication] delegate];
//Create a todo Object.
todo *todoObj = [[todo alloc] initWithPrimaryKey:0];
todoObj.todotitle = txttodotitle.text;
todoObj.tododes = txttododes.text;
/*
NSString *temp = [[NSString alloc] initWithString:txttododes.text];
todoObj.tododes = temp;
[temp release];
*/
todoObj.isDirty = NO;
todoObj.isDetailViewHydrated = YES;
//Add the object
[appDelegate addtodo:todoObj];
//Dismiss the controller.
[self.navigationController dismissModalViewControllerAnimated:YES];
}
and the error massages output in console is:
2010-06-03 17:12:45.720 Home[29728:207] No Errors 2010-06-03 17:12:45.726 Home[29728:207] WARNING: Using legacy cell layout due to delegate implementation of tableView:accessoryTypeForRowWithIndexPath: in . Please remove your implementation of this method and set the cell properties accessoryType and/or editingAccessoryType to move to the new cell layout behavior. This method will no longer be called in a future release. 2010-06-03 17:12:59.447 Home[29728:207] * Assertion failure in -[todo addtodo], /Users/HOME/Desktop/withretriveAnn/Home copy 5-ToDO/Classes/todo.m:90 2010-06-03 17:12:59.448 Home[29728:207] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error while creating add statement. 'no such table: todo''
- for sure I used iPhone Database to save the ToDo list.