You shouldn't be copying the details into NSUserDefaults
inside the app. This is how you are mixing up details from different users. Just use NSUbiquitousKeyValueStore
on its own.
Well, more realistically, you can copy data, but you shouldn't just always copy all data between both stores.
You should be observing NSUbiquityIdentityDidChangeNotification
and NSUbiquitousKeyValueStoreDidChangeExternallyNotification
and checking the reason for NSUbiquitousKeyValueStoreAccountChange
(from NSUbiquitousKeyValueStoreChangeReasonKey
). When you detect that the user account changed you need to 'reset' any local data either to default values or to cloud values (and prevent any update to cloud values before that happens).