2013-06-12 49 views
0

我使用此方法進行不備份,並且輸出總是成功。但備份數據也在ipad中備份請幫助我。'skip-backup'屬性總是返回備份而不是跳過過程

-(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; 
} 
} 

上面的方法我用。請幫我anybody.thanks

回答

1

我解決這個問題。我發現錯誤的NSUserdefault優先這個NSUserdefault存儲的數據存儲在plist文件中,以便NSUserdefault數據刪除和解決問題。

+0

感謝您的支持Bro .. –

相關問題