以任何方式预先填充核心数据? [英] Any way to pre populate core data?

查看:104
本文介绍了以任何方式预先填充核心数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在创建一个列表应用程序,并用核心数据来支持它。



我想有一个默认的机场项目列表,用户不必从头开始。



有什么办法吗?



任何帮助。
提前感谢。

解决方案

这是最好的方法(不需要SQL知识):

使用与List应用程序相同的对象模型创建快速Core Data iPhone应用程序(甚至Mac应用程序)。编写几行代码以保存您想要存储的默认托管对象。然后,在模拟器中运行该应用程序。现在,去〜/ Library /应用程序支持/ iPhone模拟器/用户/应用程序。在GUID中找到您的应用程序,然后只需将sqlite存储复制到您的List应用程序的项目文件夹中。



然后,加载该存储像在CoreDataBooks示例中。 / p>

I've been creating a list app and backing it with core data.

I would like to have a default list of say 10 airport's items, so that the user doesn't have to start from scratch.

Is there any way to do this?

Any help is appreciated. Thanks in advance.

解决方案

Here's the best way (and doesn't require SQL knowledge):
Create a quick Core Data iPhone app (Or even Mac app) using the same object model as your List app. Write a few lines of code to save the default managed objects you want to the store. Then, run that app in the simulator. Now, go to ~/Library/Application Support/iPhone Simulator/User/Applications. Find your application among the GUIDs, then just copy the sqlite store out into your List app's project folder.

Then, load that store like they do in the CoreDataBooks example.

这篇关于以任何方式预先填充核心数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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