核心数据不更新 [英] Core Data does not update

查看:151
本文介绍了核心数据不更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我采取的步骤顺序:

This is the sequence of steps I have taken:


  • 将资料载入表格检视

  • 添加新数据

  • 点击查看单元格的更多详细信息

  • 加载详细信息

  • / li>

  • 返回表格视图

  • 一切都很好

  • 重新打开应用程序

  • 没有更新

  • Load data into table view
  • add new data
  • click to see more details on cells
  • load the details
  • edit details
  • press save
  • back to table view
  • everything is fine
  • re-open the application
  • nothing updated

,我没有解决它。不,我也与CoreData堆叠。

I had this problem also with sqlite, and I didn't fix it. No, I am also stacked with CoreData.

-(IBAction)save:(id)sender
{
    [passwords setValue:nametxt.text forKey:@"name"];

    [passwords setValue:usernametxt.text forKey:@"username"];


}

-(void) viewWillAppear:(BOOL)animated
{
    self.title = passwords.name;

    nametxt.text = passwords.name;
    usernametxt.text = passwords.username;

}


推荐答案

调用 NSManagedObjectContext save 方法。

NSError *error = nil;
[managedObjectContext save:&error];
if (error) {
//inform user
}

这篇关于核心数据不更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆