RK with SQLite instead of Core Data

190 visualizzazioni
Passa al primo messaggio da leggere

Old McStopher

da leggere,
7 mar 2012, 12:35:1207/03/12
a res...@googlegroups.com
I see that an RKManagedObjectStore can be created with a SQLite database. Is there any RK-supported way to map relationships with the SQLite directly without having to create Core Data entities? I'm not sure if my question is even making sense. I just know that one potential constraint on our application will be using SQLite across all platforms.

Does anyone have any good examples of how to map relationships with RestKit using SQLite instead of Core Data? (I was under the impression that Core Data entities had to be created for this to happen.

We have class definitions for some structural container objects, but runtime-specified model objects will have to be created on the fly and will not have classes predefined for them.

Many thanks

Michał Domański

da leggere,
8 mar 2012, 04:58:1808/03/12
a res...@googlegroups.com
Few questions:
1. Core Data {is|can be} backend by SQLite, so why can't you use CoreData ? I mean, you can programatically attach new backing stores to CoreData, AFAIK on-the-fly, there's even a talk on WWDC 2011 about such hacks.
2. Since iOS 5.0 you can provide your own solutions in terms of incremental backing stores
3. RestKit can map to CoreData using RKManagedObjectMappings or to simple NSObject subclasses via RKObjectMapping. Then you can grab your objects in proper delegate callback, map/deserialize and save to SQLite

In my private opinion using raw SQLite in iOS is generally bad idea. It's slower than CoreData (CoreData is up to 70% faster, if properly handled), requires you to write a lot of boilerplate code and has rather unusable API. Also, CoreData integrates extremelly well into CocoaTouch, especially UITableViewController

2012/3/7 Old McStopher <schem...@gmail.com>



--
---------------------------
Michał Domański

Rispondi a tutti
Rispondi all'autore
Inoltra
0 nuovi messaggi