Question

Yes, this is insane, adding more complexitiy to an already complicated problem.

My use requires me to ideally use iCloud+Coredata and it famously fails badly. in iOS7 I wouldn't completely depend on it. So Im looking at what else can I do to get some cloud support. Since I'm an iPhone user, iCloud is very ideal for me only because of its deamon integrated OS Level. I wouldn't have to worry about my offline changes, atleast in theory.

Heres what I'm thinking of doing.

The app i want to use this in is Not a todolist, or something that requires hard syncing. The DB has very simple tables, data-table and folders-table and data-folders-linker. Like the good old sqlite table.

I want to sync it to iCLoud in UIDocuments where i'd store the folders metadata within the single uidocument. For each entry in data-table, a new uidocument would be created in iCloud.

A new device upon getting the "new" uidocument would parse its data into the sqlite-store.

thats about it. Obviously, Its not perfect, nor is it remotely advisable. BUT I NEED CLOUD!

Already I see problems.

  1. How would a know a new UIDocument has arrived.
  2. How would I know that "this" UIDocument was deleted.
  3. Since I should not persist all UIDocuments into a tableView, i'll have that parsed into SQLite store. But I'd have to monitor alot of complex notifications and figure out what happened to the document and make changes to the sqlite-store.

One of the big reasons I was thinking about this is only because of my simple db structure. Please tell me how this is super flawed, and I shouldn't even attempt it, I'm doing this for me, and really needed some cloud support.

Was it helpful?

Solution

Use iCloud + Core Data. Mark all relations optional, store objects IDs in data-folders-linker, and enforce them programmatically. You can do it because your db is simple enough.

iOS7 even deletes orphaned objects with non-optional parents and cascade deletes during conflict resolution. That will save you some code in the future.

Letting aside relationships and validation, ICCD has the same problems of document and key-value sync, just at a different granularity.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top