In iOS6, this method returns an id unique to each iCloud account:
[[NSFileManager defaultManager] ubiquityIdentityToken]
In iOS5, the only way to check whether iCloud is available is by using:
[[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil]
This will do for checking the iCloud availability in iOS5, but how do I distinguish users (iCloud accounts) in iOS5?
I am syncing Core Data in the iCloud, but I also want to be able to use the app without an iCloud account. Hence I cannot use a .nosync folder and so I need to manage access to the stores myself (making sure that each iCloud account can only access its own files). To do this, I put all Core Data stores from the same iCloud account in its own folder, the folder's name is generated using the ubiquityIdentityToken, since this is unique for each iCloud account.
Is there some other way of getting some UUID based on the iCloud account? As far as I have investigated, there is nothing unique in the URLForUbiquityContainerIdentifier either that I can use. Or is there another way in which I can manage access besides using folder specific access?
Related question: An equivalent for ubiquityIdentityToken under OSX 10.7
No, there is no API on iOS 5 that serves this purpose.
However, Core Data's iCloud integration is generally not all that reliable on iOS 5 anyway. If you must support iCloud via Core Data, aim for iOS 6.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With