Skip to content

Conversation

@fzhinkin
Copy link
Collaborator

Starting from May 1, 2024 developers have to explicitly declare why they use APIs allowing to access file timestamps in privacy manifest files; otherwise, an app won't be accepted by the AppStore.

The only restricted API we're currently using is stat, and since we don't extract any timestamps using it, we can safely replace it with NSFileManager::fileAttributesAtPath.

For more details on the restriction imposed on timestamp-accessing APIs read https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api

Closes #297

Starting from May 1, 2024 developers have to explicitly
declare why they use APIs allowing to access
file timestamps in a privacy manifest files;
otherwise an app won't be accepted by the AppStore.
The only restricted API we're currently using
is stat, and since we don't extract any timestamps
using it, we can safely replace it with
NSFileManager::fileAttributesAtPath.

For more details on the restriction imposed on
timestamp-accessing APIs read https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api

Closes #297
@fzhinkin fzhinkin marked this pull request as ready for review April 22, 2024 08:19
@fzhinkin fzhinkin requested a review from shanshin April 22, 2024 08:49
}

internal actual fun metadataOrNullImpl(path: Path): FileMetadata? {
val attributes = NSFileManager.defaultManager().fileAttributesAtPath(path.path, traverseLink = true) ?: return null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is invoking NSFileManager.defaultManager() is a cheap operation?
Can we lazily cache default manager?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
*/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No special Gradle configuring for the new source set?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fzhinkin fzhinkin merged commit e7cf4cf into develop Apr 22, 2024
@fzhinkin fzhinkin deleted the 297-dont-use-stat-on-apple-targets branch April 22, 2024 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace required reason APIs with equipment Foundations APIs on Apple targets

3 participants