Skip to content

Commit 76ce306

Browse files
committed
wizard: fix IPSW selection not working
1 parent 332a662 commit 76ce306

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Platform/Shared/VMWizardOSMacView.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ struct VMWizardOSMacView: View {
5858
wizardState.busyWorkAsync {
5959
#if arch(arm64)
6060
let url = try result.get()
61+
let scopedAccess = url.startAccessingSecurityScopedResource()
62+
defer {
63+
if scopedAccess {
64+
url.stopAccessingSecurityScopedResource()
65+
}
66+
}
6167
let image = try await VZMacOSRestoreImage.image(from: url)
6268
guard let model = image.mostFeaturefulSupportedConfiguration?.hardwareModel else {
6369
throw NSLocalizedString("Your machine does not support running this IPSW.", comment: "VMWizardOSMacView")

Platform/macOS/VMConfigAppleBootView.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ struct VMConfigAppleBootView: View {
136136
case .ipsw:
137137
if #available(macOS 12, *) {
138138
#if arch(arm64)
139+
let scopedAccess = url.startAccessingSecurityScopedResource()
140+
defer {
141+
if scopedAccess {
142+
url.stopAccessingSecurityScopedResource()
143+
}
144+
}
139145
let image = try await VZMacOSRestoreImage.image(from: url)
140146
guard let model = image.mostFeaturefulSupportedConfiguration?.hardwareModel else {
141147
throw NSLocalizedString("Your machine does not support running this IPSW.", comment: "VMConfigAppleBootView")

0 commit comments

Comments
 (0)