How to programmatically detect if the iCloud is enabled on user's device when only use NSUbiquitousKeyValueStore?

后端 未结 2 571
温柔的废话
温柔的废话 2020-12-31 08:26

I am using NSUbiquitousKeyValueStore to sync some preference data to iCloud. I found that if the user disable \"Document & Data\" item of iCloud in \"Settin

2条回答
  •  囚心锁ツ
    2020-12-31 09:13

    I don't know if the docs have been updated, but Apple is now saying:

    To determine if iCloud is available, especially at launch time, check the value of the ubiquityIdentityToken property instead

    See NSFileManager for both ubiquityIdentityToken and URLForUbiquityContainerIdentifier.

    Note also that Apple is saying that URLForUbiquityContainerIdentifier can be relatively slow, and that checking ubiquityIdentityToken is relatively fast.

    This is for iOS6 and higher.

提交回复
热议问题