0

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.

user134611
  • 766
  • 1
  • 11
  • 22
  • Try iCloud + Core Data first. You get it for free and it's likely to work for a simple structure like yours. – Jano Jul 16 '13 at 22:27
  • I'm a little scared to go all-in into icloud+coredata. I thought using a flexible sqlite localstore and document files would be me some flexibility into the future, I'm looking at dropbox datastore sync. if need arises. – user134611 Jul 17 '13 at 01:53
  • "Put On Hold": I don't know how to narrow this question down. This was an approach-theory question. If this is not allowed, I apologise, I should read the posting guidlines. – user134611 Jul 17 '13 at 19:26

1 Answers1

0

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.

Jano
  • 62,815
  • 21
  • 164
  • 192