[英]How can I confirm that iCloud Backup is enabled for my app?
I have an iOS app that stores large amounts of data on the device. 我有一个iOS应用程序,可在设备上存储大量数据。 We rely on iCloud Backup to preserve data in case the user replaces or resets their device. 我们依靠iCloud备份来保留数据,以防用户更换或重置设备。
Unfortunately, users sometimes disable iCloud backup for just our app to save space on iCloud; 不幸的是,有时用户仅对我们的应用程序禁用iCloud备份,以节省iCloud上的空间。 then, months later, they attempt to restore data onto their new device but there's no app data to restore because they stopped backing it up. 然后,几个月后,他们尝试将数据还原到新设备上,但是由于要停止备份,因此没有要还原的应用程序数据。
I'd really, really like to be able to find out if the user has iCloud Backup checked for our particular app, so we can give users occasional alerts warning them that their data is not being backed up. 我真的非常希望能够发现用户是否已为我们的特定应用程序检查了iCloud Backup,因此我们可以偶尔向用户发出警报,警告他们其数据尚未备份。
Is there any way to programmatically determine whether my app has the iCloud Backup slider set to ON or OFF? 有什么方法可以通过编程确定我的应用程序的iCloud Backup滑块设置为ON还是OFF?
看一下NSFileManager
上的ubiquityIdentityToken
属性,如果为您的应用设置并启用了iCloud,则该属性应该为非零。
You can't. 你不能 That is because you don't say to iCloud Backup that you want your app to be backed up, it just takes NSUserDefaults and files (not flagged) from DocumentsDirectory and saves them. 那是因为您没有对iCloud Backup说要备份您的应用程序,它只是从DocumentsDirectory中获取NSUserDefaults和文件(未标记)并保存它们。 You could better write an Alert to give more information why is so important having this backup on and show her once. 您最好编写一个Alert来提供更多信息,以了解为什么备份如此重要并一次显示给她。
Oh and please bear in mind that storing to iCloud non-user-generated content may lead to reject your app because: 哦,请记住,将非用户生成的内容存储到iCloud可能会导致拒绝您的应用程序,因为:
Important : Apps should avoid mingling app data and user data in the same file. 重要提示 :应用程序应避免将应用程序数据和用户数据混合在同一文件中。 Doing so will unnecessarily increase backup sizes and can be considered a violation of the iOS Data Storage Guidelines. 这样做会不必要地增加备份大小,并且可以认为这违反了iOS数据存储准则。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.