Question

I'm trying to figure out what exactly the UIDocument subclass should look like when the file I'm trying to sync/share via iCloud is essentially an NSDictionary.

The dictionary file (plist) has a bunch of keys that are primary keys. each key could have another dictionary.

I've seen examples of UIDocuments that have just one property of NSString. All they do is sync those "notes" between devices.

When it comes to this.. what Should I treat UIDocument like? Maybe each key in the NSDictionary is a UIDocument? or Should the whole document should be synced.

Any examples would be very helpful.

Was it helpful?

Solution

It depends on what you want to do. Think of a document as something the user can see: rename, create, delete.

If those documents in your app have several properties that are stored in a NSDictionary, then you can just add a NSDictionary as an ivar of your UIDocument subclass.

If, on the other hand, the various primary keys in your dictionary are "separate" and belong to different top-level entities, then you might want to store each value in a separate document.

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