<small id='dt8xp'></small><noframes id='dt8xp'>

  • <tfoot id='dt8xp'></tfoot>

      <bdo id='dt8xp'></bdo><ul id='dt8xp'></ul>
    1. <i id='dt8xp'><tr id='dt8xp'><dt id='dt8xp'><q id='dt8xp'><span id='dt8xp'><b id='dt8xp'><form id='dt8xp'><ins id='dt8xp'></ins><ul id='dt8xp'></ul><sub id='dt8xp'></sub></form><legend id='dt8xp'></legend><bdo id='dt8xp'><pre id='dt8xp'><center id='dt8xp'></center></pre></bdo></b><th id='dt8xp'></th></span></q></dt></tr></i><div id='dt8xp'><tfoot id='dt8xp'></tfoot><dl id='dt8xp'><fieldset id='dt8xp'></fieldset></dl></div>

        <legend id='dt8xp'><style id='dt8xp'><dir id='dt8xp'><q id='dt8xp'></q></dir></style></legend>

        防止 iCloud 同步数据(使用 .nosync?)

        时间:2023-05-31

          <tfoot id='ijrF4'></tfoot>
          <i id='ijrF4'><tr id='ijrF4'><dt id='ijrF4'><q id='ijrF4'><span id='ijrF4'><b id='ijrF4'><form id='ijrF4'><ins id='ijrF4'></ins><ul id='ijrF4'></ul><sub id='ijrF4'></sub></form><legend id='ijrF4'></legend><bdo id='ijrF4'><pre id='ijrF4'><center id='ijrF4'></center></pre></bdo></b><th id='ijrF4'></th></span></q></dt></tr></i><div id='ijrF4'><tfoot id='ijrF4'></tfoot><dl id='ijrF4'><fieldset id='ijrF4'></fieldset></dl></div>
              <tbody id='ijrF4'></tbody>
              <bdo id='ijrF4'></bdo><ul id='ijrF4'></ul>

                • <small id='ijrF4'></small><noframes id='ijrF4'>

                  <legend id='ijrF4'><style id='ijrF4'><dir id='ijrF4'><q id='ijrF4'></q></dir></style></legend>
                • 本文介绍了防止 iCloud 同步数据(使用 .nosync?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  到目前为止,我能想到的最好的方法是弹出一个窗口,要求用户禁用 iCloud 同步,同时将所有数据移动到 Documents 目录,这样它就不会了t 被擦除:在iOS5中,是否可以检测用户是否设置了要备份的应用程序?

                  我为 iPhone/iPad 开发离线地图应用程序.

                  I develop offline mapping application for iPhone/iPad.

                  我们过去将所有数据(可能有很多演出)存储在 Caches 目录中.

                  We used to store all of the data (many gigs potentially) in the Caches directory.

                  从 iOS5 开始,当用户的硬盘开始变满时,可以随机删除 Caches 目录中的文件.

                  As of iOS5, the files in the Caches directory can be randomly deleted when the user's hard drive starts getting full.

                  如何在不将数据同步到 iCloud、iTunes 且不被随机删除的情况下存储本地数据?我的本地数据是一个大型目录树,其中包含许多小数据文件,位于数千个子目录中.

                  How can I store local data, without the data being synced to iCloud, iTunes, and without it being randomly deleted? My local data is a large directory tree with many small data files, in thousands of subdirectories.

                  我将目录树从库缓存目录移动到文档目录中的 data.nosync 目录,因为我们已经阅读过这可能是一个解决方案.但是,nosync 文件夹中的数据仍在备份到 iCloud.

                  I moved our directory tree from the library cache directory to a data.nosync directory in the documents directory, because we had read this might be a solution. However, the data in the nosync folder is still being backed up to iCloud.

                  现在我创建目录:

                  NSString* noSyncDirectory() {
                    static NSString *directory = nil;
                    if (!directory) {
                      directory = [[NSString stringWithFormat:@"%@/%@",
                                    documentsDirectory(), @"data.nosync"] retain];
                      [Constants createDirectoryIfNeeded:directory];
                    }
                    return directory;
                  }
                  

                  推荐答案

                  来自:https://developer.apple.com/library/ios/#qa/qa1719/_index.html

                  您可以使用以下方法设置不备份"扩展属性.每当您创建不应备份的文件或文件夹时,将数据写入文件,然后调用此方法,将 URL 传递给文件.

                  You can use the following method to set the "do not back up" extended attribute. Whenever you create a file or folder that should not be backed up, write the data to the file and then call this method, passing in a URL to the file.

                  #include <sys/xattr.h>
                  - (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
                  {
                      const char* filePath = [[URL path] 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;
                  }
                  

                  可以找到更多信息:https://developer.apple.com/icloud/documentation/data-storage/

                  进一步说明:虽然开发人员文档错误地暗示(这些文件将不会被清除并且不会包含在用户的 iCloud 或 iTunes 备份中.")不备份标志兼作不 -清除标志并非如此.只需将文件留在缓存目录中并标记它们不备份不会阻止它们的擦除.

                  Further note: While the developer documentation incorrectly implies ("These files will not be purged and will not be included in the user's iCloud or iTunes backup.") that the do-not-backup flag doubles as a do-not-purge flag that is not the case. Simply leaving files in the Caches Directory and flagging them do-not-backup will not prevent their wipe.

                  这篇关于防止 iCloud 同步数据(使用 .nosync?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:将新的视图控制器链接到情节提要? 下一篇:在 iOS 中获取有关时区更改的通知

                  相关文章

                  最新文章

                • <i id='yuAkI'><tr id='yuAkI'><dt id='yuAkI'><q id='yuAkI'><span id='yuAkI'><b id='yuAkI'><form id='yuAkI'><ins id='yuAkI'></ins><ul id='yuAkI'></ul><sub id='yuAkI'></sub></form><legend id='yuAkI'></legend><bdo id='yuAkI'><pre id='yuAkI'><center id='yuAkI'></center></pre></bdo></b><th id='yuAkI'></th></span></q></dt></tr></i><div id='yuAkI'><tfoot id='yuAkI'></tfoot><dl id='yuAkI'><fieldset id='yuAkI'></fieldset></dl></div>
                  • <bdo id='yuAkI'></bdo><ul id='yuAkI'></ul>
                • <legend id='yuAkI'><style id='yuAkI'><dir id='yuAkI'><q id='yuAkI'></q></dir></style></legend>

                      <small id='yuAkI'></small><noframes id='yuAkI'>

                      <tfoot id='yuAkI'></tfoot>