gpt4 book ai didi

ios - iCloud 正在备份我的应用程序的 68 字节(一个 plist 文件),我是否需要设置一个标志以将其从 icloud 备份中排除?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:39:28 26 4
gpt4 key购买 nike

我的 iOS 应用程序被 App Store 拒绝,因为我将一些图像和 SQLite 数据库存储到文档目录中并且没有为它们设置标志(不包括同步到 iCloud),这违反了 iOS 数据存储指南。

现在我已经将 Assets 和数据库 sqlite 数据等所有内容移动到库/应​​用程序支持/离线数据中,并将所有内容标记为排除在 iCloud 中,使用这个很棒的 StandardPath图书馆

现在,当我运行该应用程序时,我仍然发现 68 字节的数据正在备份到 iCloud,而且我发现它是位于 Library/Preferences/au.com.xxxx.plist 中的 plist 文件(因为它恰好是 68 字节)

我的问题是,我是否也应该为该 plist 目录设置一个标志?还是无所谓?因为我不想再次被拒绝

有一个similar post在这里,OP 设法将 0kb 备份到 icloud。

We found that your app does not follow the iOS Data Storage Guidelines, which is required per the App Store Review Guidelines.

In particular, we found that on launch and/or content download, your app stores 7.1 MB. To check how much data your app is storing:

  • Install and launch your app
  • Go to Settings > iCloud > Storage & Backup > Manage Storage
  • If necessary, tap "Show all apps"
  • Check your app's storage

The iOS Data Storage Guidelines indicate that only content that the user creates using your app, e.g., documents, new files, edits, etc., should be backed up by iCloud.

Temporary files used by your app should only be stored in the /tmp directory; please remember to delete the files stored in this location when the user exits the app.

Data that can be recreated but must persist for proper functioning of your app - or because customers expect it to be available for offline use - should be marked with the "do not back up" attribute. For NSURL objects, add the NSURLIsExcludedFromBackupKey attribute to prevent the corresponding file from being backed up. For CFURLRef objects, use the corresponding kCFURLIsExcludedFromBackupKey attribute.

For more information, please see Technical Q&A 1719: How do I prevent files from being backed up to iCloud and iTunes?.

最佳答案

如果您不想备份到 iCloud,请将此方法添加到您的应用委托(delegate)中。

- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *documentsDirectoryPath = [paths objectAtIndex:0];

const char* filePath = [documentsDirectoryPath fileSystemRepresentation];
const char* attrName = "com.apple.MobileBackup";
u_int8_t attrValue = 1;
int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
return result == 0;
}

关于ios - iCloud 正在备份我的应用程序的 68 字节(一个 plist 文件),我是否需要设置一个标志以将其从 icloud 备份中排除?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23485810/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com