Adding the “Do Not Backup” attribute to a folder hierarchy in iOS 5.0.1

后端 未结 6 902
遇见更好的自我
遇见更好的自我 2020-12-07 21:32

Referencing iCloud + Storage of media in iPhone Documents folder, which shows how to set the iOS 5.0.1 \"Do Not Backup\" attribute for a file.

Is there an efficient

6条回答
  •  醉酒成梦
    2020-12-07 22:05

    you can do the following in swift:

    func addSkipBackupAttributeToItemAtPath(path:String) -> Bool {
    
    
        let filePath = path.fileSystemRepresentation()
        let attrName  = "com.apple.MobileBackup"
    
        var attrValue : uint_fast8_t = 1
    
        let result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue.dynamicType), 0, 0)
    
        return result == 0
    }
    

提交回复
热议问题