diff --git a/Platform/Shared/VMWizardOSMacView.swift b/Platform/Shared/VMWizardOSMacView.swift index 51c7eeaa3..f66f0ae64 100644 --- a/Platform/Shared/VMWizardOSMacView.swift +++ b/Platform/Shared/VMWizardOSMacView.swift @@ -58,6 +58,12 @@ struct VMWizardOSMacView: View { wizardState.busyWorkAsync { #if arch(arm64) let url = try result.get() + let scopedAccess = url.startAccessingSecurityScopedResource() + defer { + if scopedAccess { + url.stopAccessingSecurityScopedResource() + } + } let image = try await VZMacOSRestoreImage.image(from: url) guard let model = image.mostFeaturefulSupportedConfiguration?.hardwareModel else { throw NSLocalizedString("Your machine does not support running this IPSW.", comment: "VMWizardOSMacView") diff --git a/Platform/macOS/VMConfigAppleBootView.swift b/Platform/macOS/VMConfigAppleBootView.swift index 8ce11d089..949fa82bb 100644 --- a/Platform/macOS/VMConfigAppleBootView.swift +++ b/Platform/macOS/VMConfigAppleBootView.swift @@ -136,6 +136,12 @@ struct VMConfigAppleBootView: View { case .ipsw: if #available(macOS 12, *) { #if arch(arm64) + let scopedAccess = url.startAccessingSecurityScopedResource() + defer { + if scopedAccess { + url.stopAccessingSecurityScopedResource() + } + } let image = try await VZMacOSRestoreImage.image(from: url) guard let model = image.mostFeaturefulSupportedConfiguration?.hardwareModel else { throw NSLocalizedString("Your machine does not support running this IPSW.", comment: "VMConfigAppleBootView")