简体   繁体   中英

iPhone, Core Data and JSON

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.

I hope that is clear.

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.

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.

不可以,您只能使用XML,SQLite或内存存储。

有一个执行JSON =>核心数据同步的库: https : //github.com/sixdegrees/lidenbrock

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM