Database Reference
In-Depth Information
Ubiquity Container
The Ubiquity Container is sometimes referred to as the iCloud container. It is a physically separate
folder or container on the device to which your application has access. Any file data that your
application puts into the container will be uploaded to iCloud and pushed down to the users' other
devices that have your app installed.
The container is first created when you request the container URL from the iCloud Storage API.
You should also never call this method on the main thread because it will lock the UI.
When you first put a file into the container, the entire document is uploaded to iCloud. If that document
changes for any reason only certain pieces of that file are sent up to iCloud to trigger those changes.
This method allows iCloud to remain efficient while keeping all the documents it handles up to date.
Document Metadata
One of the nice features of iCloud is how it handles your file metadata. Your files' metadata take
precedence over the actual data contained inside the document. The document service is very
aggressive about pushing metadata to the cloud ahead of the actual changed data. What this means
to you as a developer is that your application is going to be aware of all the files available to it even if
that file's data hasn't been completely pushed to iCloud or downloaded to your device.
Document Data
The data within your document exists in iCloud until you explicitly request that it be downloaded.
Once the file is downloaded, iCloud propagates any changes to the document down to your device.
The document service handles document data this way in order to conserve storage space on your
mobile device. So, suppose you have 100MB of documents stored in iCloud and you realize that
you want to edit one that is 5MB. The document service only pulls down that individual file, leaving
the other 95MB on the server. Now, your application is still aware of these other files thanks to the
metadata being persisted across devices. This efficiency is one of the many reasons that iCloud is a
superior technology to use in your iOS apps.
Peer to Peer
Another optimization that has been made for iCloud is the use of peer to peer technology. When you
change a document on one device, that change can be sent over peer to peer connection to other
devices rather than taking the full round trip to the iCloud servers and back down to each device.
Peer to peer will only function when your devices are on the same network.
Conflict Resolution
Document Storage used automatic conflict resolution. What this means is that if you edit the same
file on two different devices at the same time, iCloud will see that these edits are in conflict. It will
resolve the conflict automatically by selecting what it believes is the most up to date file. However,
you are also notified of this conflict. The iCloud Storage API gives you the ability to traverse through
file versions and resolve the conflict manually if needed.
 
Search WWH ::




Custom Search