开发者

manageObjectContext giving error

todoList *todolist = [NSEntityDescription insertNewObjectForEntityForName:@"todoList" inManagedObjectContext:[self managedObjectContext]];
//todolist1 = [NSEntityDescription insertNewObjectForEntityForName:@"todoList" inManagedObjectContext:self.managedObjectContext];   
[patients addTodosObject:todolist];
todolist.todoItem = txtAddTodo.text;
todolist.todoDate = txtTodoDate.text;
todolist.todoTime = txtTodoTime.text;
N开发者_JAVA百科SError *error = nil;
if (![patients.managedObjectContext save:&error]) {        //It crashes Here
    // Handle error
    NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
    exit(-1);  // Fail
}   


Please give the error displayed in the console, as suggested by Manu. However, you can try going into the iOS Simulator and selecting iOS Simulator > Reset Content and Settings. By clearing the previous database, this often fixes weird errors associated with Core Data (especially if you're modifying the model).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜