Why is ubiquityIdentityToken always zero?

I am developing an iOS app that uses CloudKit. Apple documentation says that I have to use the NSFileManager ubiquityIdentityToken property to determine if a service is available. But the property is always zero. How can i do this? I am testing my app on an iPhone 5 simulator with iOS 8.2. And I am also logged into iCloud account. I have iCloud Drive enabled as well. (Someone says enabling iCloud Drive might fix this problem, but it doesn't work for me.)

I need to call the NSFileManager method URLForUbiquityContainerIdentifier :? But Apple's documentation says it is required for storing documents. He does not say that this is necessary for CloudKit.

+3


source to share


1 answer


The CKContainer method accountStatusWithCompletionHandler

is how you should check if the user is logged in to iCloud or not (supported since iOS 8.0). CloudKit Quick Start shows an example of how to use it. fetchUserRecordIDWithCompletionHandler

is another option that might make sense for your application.



In iOS 9.0, you will also have CKAccountChangeNotification

one that will notify your app when the iCloud status on the device changes.

+2


source







All Articles