title: backing up prevent from the app in iCloud
body: <p>The way <a href="https://developer.apple.com/icloud/documentation/data-storage/" rel="nofollow noreferrer">apple storage guidelines</a> is creating more problem for me because most of the data i am maintaining from the Documents directory (files,dataBase and some kind of app related stuff).Recently i uploaded a binary file to the app store it was rejected and apple provided me a report <img src="https://i.stack.imgur.com/ezN86.png" alt="Apple rejection report "> according to this point i am going to change my code as a below </p>
  
  <pre><code>- (NSString *)applicationDocumentsDirectory {
  NSString *documentPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
  NSURL *pathURL= [NSURL fileURLWithPath:documentPath];
  [self addSkipBackupAttributeToItemAtURL:pathURL];
  return documentPath;
  
  }
  
   - (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, &amp;attrValue, sizeof(attrValue), 0, 0);
  return result == 0;
  }
  </code></pre>
  
  <p><strong>MY QUESTIONS:</strong></p>
  
  <p>1.can i use addSkipBackupAttributeToItemAtURL: method directly to the documents directory to privent the iCloud backup for my all files in the documents directory.</p>
  
  <p>2.Above mentioned code is enough for my app to be approve in app store in case my last binary rejected due to "do not back up" attribute not included for my documents directory.</p>