首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >“skip - backup”属性始终返回backup而不是跳过进程

“skip - backup”属性始终返回backup而不是跳过进程
EN

Stack Overflow用户
提问于 2013-06-12 20:11:29
回答 1查看 57关注 0票数 0

我将此方法用于do not backup,且输出总是成功。但是备份数据也是在ipad中备份的,请帮帮我。

代码语言:javascript
复制
-(BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
const char* filePath = [[URL path] fileSystemRepresentation];
const char* attrName = "com.apple.MobileBackup";
if (&NSURLIsExcludedFromBackupKey == nil) {
    // iOS 5.0.1 and lower
    u_int8_t attrValue = 1;
    int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
    return result == 0;
}
else
{
    // First try and remove the extended attribute if it is present
    int result = getxattr(filePath, attrName, NULL, sizeof(u_int8_t), 0, 0);
    if (result != -1) {
        // The attribute exists, we need to remove it
        int removeResult = removexattr(filePath, attrName, 0);
        if (removeResult == 0) {
            NSLog(@"Removed extended attribute on file %@", URL);
        }
    }
    // Set the new key
    NSError *error = nil;
    [URL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error];
    return error == nil;
}
}

以上方法我使用.please help me anybody.thanks

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-06-17 18:59:54

我解决了这个问题,.i发现了NSUserdefault错误,这个NSUserdefault存储的数据优先存储在plist文件中,这样NSUserdefault数据就可以删除并解决问题。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17065177

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档