Fix security-scoped URL access balancing

This commit is contained in:
世界
2026-02-04 22:32:02 +08:00
parent 20e22b691a
commit 4ae421cd04
8 changed files with 77 additions and 32 deletions
+3 -3
View File
@@ -222,9 +222,9 @@ struct MainView: View {
}
} else if url.pathExtension == "bpf" {
do {
_ = url.startAccessingSecurityScopedResource()
importProfile = try .from(Data(contentsOf: url))
url.stopAccessingSecurityScopedResource()
importProfile = try url.withSecurityScopedAccess {
try .from(Data(contentsOf: url))
}
} catch {
alert = AlertState(error: error)
}