iPhone,Core Data和JSON [英] iPhone, Core Data and JSON

查看:114
本文介绍了iPhone,Core Data和JSON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,有一个使用JSON发布信息的API。我可以访问这个API罚款,但我真的想使用Core Data将信息存储在iPhone应用程序中。有没有办法将持久存储挂钩到JSON API,而不是使用一些算法保持它们同步,我只能使用网站作为核心数据的后端。

I have a web site with an API which publishes the information using JSON. I can access this API fine, but I would really like to store the information in an iPhone application using Core Data. Is there a way to hook the Persistent Store to the JSON API so rather than having to keep them in sync using some algorithm I can just use the web site as the back end for Core Data.

我希望这是清楚的。

推荐答案

如果你只是想使用Core Data的对象图管理设施,您可以解析JSON数据并创建与内存存储相关联的对象图。

If you just want to use Core Data for its object graph management facilities, you can parse the JSON data and create an object graph associated with an in memory store.

如果要以序列化的JSON格式保存此数据,Core Data有创建新的原子存储类型的设施。您可以写一个JSON存储作为XML存储格式的替代。

If you want to persist this data in a serialized JSON format, Core Data does have the facility for creating new atomic store types. You could write a JSON store as an alternative to the XML store format.

这篇关于iPhone,Core Data和JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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