gpt4 book ai didi

iphone - 使用此代码从iCloud备份中排除文件后,为什么我的应用程序仍然被拒绝?

转载 作者:行者123 更新时间:2023-12-01 18:00:32 26 4
gpt4 key购买 nike

我添加了以下代码以从iCloud备份中排除文件,但我的应用程序仍然被拒绝:

   - (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
if (&NSURLIsExcludedFromBackupKey == nil) { // iOS <= 5.0.1
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;
} else { // iOS >= 5.1


NSLog(@"%d",[URL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:nil]);
return [URL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:nil];
}
}

在模拟器的情况下,我将以下网址作为NSURL传递:

file:///Users/TEST/Library/Application%20Support/iPhone%20Simulator/5.1/Applications/62854BAB-AB51-4771-895F-28C61983A7AC/Documents/MyFolder“

有人能暗示我的错误在哪里吗?

最佳答案

问题在于您传入的URL。

即使您将数据存储在文件夹中,该数据仍然是两件事

  • 在documents文件夹中,因此将同步
  • 该文件夹与您的应用程序相关联

  • 要解决此问题,您需要将其存储在/ Library中而不是/ Documents中

    所以您的网址是

    文件:///Users/TEST/Library/Application%20Support/iPhone%20Simulator/5.1/Applications/62854BAB-AB51-4771-895F-28C61983A7AC/ / MyFolder

    自从实施iCloud以来,Apple新的偏好是将不可同步数据或仅任何外部数据存储在Library文件夹中

    关于iphone - 使用此代码从iCloud备份中排除文件后,为什么我的应用程序仍然被拒绝?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10588652/

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