2.23 – Apps must follow the iOS Data Storage Guidelines or they will be rejected

  • It’s a violation of Apple’s storage rules
  • I abstracted some of the articles

Under the application when it starts in the Documents produced 5.6 M of data, that is not the user to create and used for backup, by modifying the application, the document directory and the attribute of a backup (NSURLIsExcludedFromBackupKey) after approval. To summarize the storage specification after iOS5: u Only user-generated Documents and other data, or data that cannot be reconstructed by your application, should be stored in the /Documents directory. These data files will be automatically backed up via iCloud. U Data that can be re-downloaded or re-created should be stored in the /Library/Caches directory. You can put database cache files or downloadable content such as magazines, newspapers, map app data in Caches directory u Temporary data should be stored in/TMP. Although these files aren’t backed up to iCloud, remember to delete them as soon as you no longer need them so they don’t continue to waste storage space on your device. U Use the “Do Not Back Up” attribute to specify files that do not require iCloud backup (for example, files that need to be used offline; This property works in any directory. Because these files occupy space on the device, the application needs a mechanism to periodically monitor and clean these files.

  • We generally have a requirement that users do not have to back up to icloud, but not temporary files.

Then we need to keep this file from backing up icloud

  • Apple document write very clear, but I only find the oc version of https://developer.apple.com/library/ios/qa/qa1719/_index.html

  • I have translated version for swift let docPath = NSSearchPathForDirectoriesInDomains (. DocumentDirectory,. UserDomainMask, true)[0] addSkipBackupAttributeToItemAtPath(docPath as String)

    func addSkipBackupAttributeToItemAtPath(filePath:String) { if let url:NSURL = NSURL(fileURLWithPath: filePath) { do { try url.setResourceValue(NSNumber(bool: true), forKey: Catch _ as NSError NSURLIsExcludedFromBackupKey)} {print (" error ")}}}Copy the code
  • Version 2 func addSkipBackupAttributeToItem () {/ / / get the let xx = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory,inDomains: .UserDomainMask)[0] let url = xx.URLByAppendingPathComponent(“output.mp4″) do { try url.setResourceValue(NSNumber(bool: True), forKey: catch _ as NSError NSURLIsExcludedFromBackupKey)} {print (” error “)}

}

  • ###### Look at me so cute n(≧ del ≦)n
  • Pay attention to my meager deskmate (beam) : http://weibo.com/tongrenyinsheng
  • http://www.tongrenyinsheng.com website (fan sounds)
  • Ios personally written app (homophone) ASMR music