iOS 5.0.1 : How to verify that the folder is marked as "Do not back up" for iCloud?

I want to set Do not back up to my folder which is in Document Directory.

I found code for "Do not back up" , but how do i verify that the folder is marked.


Solution 1:

For iOS 5.1, run the app in the simulator, and run the following command in the Terminal:

xattr {filename}

You should see the following if the item is correctly marked for exclusion:

com.apple.metadata:com_apple_backup_excludeItem 

Solution 2:

According to the docs you linked, if you set the method up exactly how they have it listed on that page, the method will return YES if the attribute is marked correctly.

Solution 3:

  1. open simulator
  2. delete the app (the app review team runs the code 1 time through, so be sure you are starting from scratch)
  3. now run your code in simulator, your code will store your files on your harddrive.
  4. open up terminal
  5. cd /Users/(user name)/Library/Application Support/iPhone Simulator/(ios version)/Applications
  6. ls
  7. you will be presented with a list of random folder names, open each one until you find your app folder
  8. for file in $(find *); do du -sk $file; xattr -l $file; echo ; done
  9. you will be presented with all of the files in the app in the format of..

    (filesize) (filename)
    (iCloud backup exclusion)

NOTE: if nothing is listed, that means the file will be backed up (if its in the Library or Documents folder).. if instead you see 'com.apple.metadata:com_apple_backup_excludeItem: com.apple.MobileBackup' then you're good to go.