将对象提交到数据库 [英] Commit objects to Database

查看:174
本文介绍了将对象提交到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在向数据库提交记录时遇到了一些问题。当我点击一个按钮,我从网站下载记录,对象在内存中,一切正常,但这些对象只是提交到核心数据,当我实际关闭的应用程序。



谨慎,
Stephen

div class =h2_lin>解决方案

NSManagedObjectContext


尝试将
的未保存更改提交到其持久
商店的对象。




   - (BOOL)save:(NSError **)error 


I'm having some trouble committing records to the database. When I click a button, I download records from the website, the objects are there in memory and everything works fine but these objects are only committed to core data when I actually close the app. Is there anyway to commit them to core data straight away, without having to close the app.

Regards, Stephen

解决方案

Call the following method on your NSManagedObjectContext:

Attempts to commit unsaved changes to registered objects to their persistent store.

- (BOOL)save:(NSError **)error

这篇关于将对象提交到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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