My app got rejected 2 times for the same reason "3.0 BEFORE YOU SUBMIT: ICLOUD" i.e, my app store data in User's iCloud. This is what Apple has to say:
Before you Submit
On launch and content download, the app still stores 7MB on the user's iCloud, which does not comply with the iOS Data Storage Guidelines.
For clarification, this refers to the data which the app allows to be backed up to the users iCloud account during iCloud device backups. If the data is generated by the app on launch (as it is in this scenario), it is not appropriate to back up with iCloud. Extensive iCloud backup usage is only permitted when the content is generated and created by the user (documents, photos, spreadsheets, etc).
Next Steps
Please verify that only the content that the user creates using your app, e.g., documents, new files, edits, etc. is backed up by iCloud as required by the iOS Data Storage Guidelines. Also, check that any temporary files used by your app are only stored in the /tmp directory; please remember to remove or delete the files stored in this location when it is determined they are no longer needed.
Data that can be recreated but must persist for proper functioning of your app - or because users expect it to be available for offline use - should be marked with the "do not back up" attribute. For NSURL objects, add the NSURLIsExcludedFromBackupKey attribute to prevent the corresponding file from being backed up. For CFURLRef objects, use the corresponding kCRUFLIsExcludedFromBackupKey attribute.
Now I have implemented NSURLIsExcludedFromBackup flag and set to true for the entire Library & Documents Directory. I am using below code:
func addSkipBackupAttributeToItemAtURL(filePath:String) -> Bool
{
let URL:NSURL = NSURL.fileURLWithPath(filePath)
assert(NSFileManager.defaultManager().fileExistsAtPath(filePath), "File \(filePath) does not exist")
var success: Bool
do {
try URL.setResourceValue(true, forKey:NSURLIsExcludedFromBackupKey)
print("Done")
success = true
} catch let error as NSError {
success = false
print("Error excluding \(URL.lastPathComponent) from backup \(error)");
}
return success
}
and call it in didFinishLaunchingWithOptions like:
let dirPaths = NSSearchPathForDirectoriesInDomains(.LibraryDirectory,.UserDomainMask, true)
let finalURL = dirPaths[0]
addSkipBackupAttributeToItemAtURL(finalURL as String)
Also my app doesn't create any temp files neither uses Documents Directory. Infant my main ViewController is static, yet Apple app review team says that app stores 7mb.
Also I had uninstalled the app cleared caches and reinstalled it on simulator & device and checked iCloud storage. There too it say "No Data"
Can you please help me understand where this 7mb review team is collecting from.
The Problem is AppIcon files. As Apple stores them in iCloud, maybe for crossplatform and display while app installs.
Go to asset --> right click AppIcon --> get info and see the size.
Solution:
Try to optimize the icons and your problem will be solved.
To Check:
Uninstall app from phone. Go to settings -> iCloud -> manage storage -> select your phone -> note Next Backup Size.
Install the app and see the size again it should not increase or Apple will reject.
Hope this will help.