The goal is store your app preference to iCloud for backup. That only involved to the key-value storage of iCould.
To use iCloud in an app. You need to configure the in the apple develop like this
Where you can store different type of data like .
Which only key-value storage don't need a container, others are needed a container to store the data in. Look into the apple document would be more helpful.
iCloudDesignGuide
Once you setup the iCould, you could be able to access NSUbiquitous store
[NSUbiquitousKeyValueStore defaultStore]
and store your key-value data like UserDefault to the ubiquitouskeyvaluestore
[[NSUbiquitousKeyValueStore defaultStore] setObject:obj forKey:key];
[[NSUbiquitousKeyValueStore defaultStore] synchronize];
and you register a notification of the key
NSUbiquitousKeyValueStoreDidChangeExternallyNotification
And analysis the notification you will get the key-value backup from your iCould account.
NSDictionary *userInfo = [notificationObject userInfo];
NSInteger reasonForChangeValue = [[userInfo objectForKey:NSUbiquitousKeyValueStoreChangeReasonKey] integerValue];
if (reasonForChangeValue == NSUbiquitousKeyValueStoreInitialSyncChange)
{
// your merge code here
}