Tuesday, March 19, 2024
HomeiOS Developmentios - KMM - Privateness pleasant file attribute APIs

ios – KMM – Privateness pleasant file attribute APIs


So Apple is beginning to require declaration when utilizing some APIs that can be utilized to fingerprint customers. I’ve obtained a Kotlin Multiplatform library that I exploit that I believe is triggering their NSPrivacyAccessedAPICategoryFileTimestamp enforcement. I’ve obtained the next code which retrieves all of the attributes of a file simply to verify if the file measurement exceeds a threshold (earlier than we roll-over to a separate file).

non-public enjoyable canWrite(): Boolean {
    val filePath = "$folder/$file"
    if (file == null || !NSFileManager.defaultManager.fileExistsAtPath(filePath)) {
        return false
    }

    val attr: Map<Any?, *>? = NSFileManager.defaultManager.attributesOfItemAtPath(filePath, null)
    if (attr == null || attr.isEmpty()) {
        return false
    }

    val fileSize = attr[NSFileSize] as Lengthy
    return fileSize < maxFileSize
}

I suppose attributesOfItemAtPath() is doing a getAttrList() within the background, which Apple paperwork as getting flagged by this verify. I do know that I can simply declare this as a reliable use of the API, however I actually do not want every little thing else that comes again from an attribute checklist, I solely care in regards to the file measurement. Is there a greater technique I may use? All of the examples I can discover on-line simply use attributesOfItemAtPath with no care and pre-date the privateness disclosures from Apple.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments