title: do not Backup flag for iOS 5.1?
body: <p>my first music downloading app get rejected due to some issues in data storage guidelines. i tried to save my mp3 file in NSDocumentDirectory. i need to resubmit my app by adding flag "Do not backup".</p>
  
  <p>here is my code,</p>
  
  <pre><code>  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  
  
  
    NSString *documentsDirectoryPath = [[paths objectAtIndex:0]stringByAppendingPathComponent:@"Music.mp3"];
    [receivedData writeToFile:documentsDirectoryPath atomically:YES];
    [self addSkipBackupAttributeToItemAtURL:downloadURL];
  
  
  
   - (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL1
        {
            if (&amp;NSURLIsExcludedFromBackupKey == nil) { // iOS &lt;= 5.0.1
            const char* filePath = [[URL1 path] fileSystemRepresentation];
  
            const char* attrName = "com.apple.MobileBackup";
            u_int8_t attrValue = 1;
  
            int result = setxattr(filePath, attrName, &amp;attrValue, sizeof(attrValue), 0, 0);
            return result == 0;
       } 
            else { // iOS &gt;= 5.1
                      NSError *error = nil;
                     [URL1 setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&amp;error];
  
                      return error == nil;
                       NSLog(@"success");
                }
        }
  </code></pre>
  
  <p>will this code work fine for my 5.1 version? bit confused</p>