diff --git a/virtualization.m b/virtualization.m index 65ae862..874fa50 100644 --- a/virtualization.m +++ b/virtualization.m @@ -1207,13 +1207,16 @@ void sharedApplication() void startVirtualMachineWindow(void *machine, double width, double height) { - @autoreleasepool { - AppDelegate *appDelegate = [[[AppDelegate alloc] - initWithVirtualMachine:(VZVirtualMachine *)machine - windowWidth:(CGFloat)width - windowHeight:(CGFloat)height] autorelease]; + if (@available(macOS 12, *)) { + @autoreleasepool { + AppDelegate *appDelegate = [[[AppDelegate alloc] + initWithVirtualMachine:(VZVirtualMachine *)machine + windowWidth:(CGFloat)width + windowHeight:(CGFloat)height] autorelease]; - NSApp.delegate = appDelegate; - [NSApp run]; + NSApp.delegate = appDelegate; + [NSApp run]; + } } + RAISE_UNSUPPORTED_MACOS_EXCEPTION(); } diff --git a/virtualization_view.h b/virtualization_view.h index e0935bc..ab00b92 100644 --- a/virtualization_view.h +++ b/virtualization_view.h @@ -6,6 +6,7 @@ #pragma once +#import #import #import @@ -22,6 +23,7 @@ - (instancetype)init; @end +API_AVAILABLE(macos(12.0)) @interface AppDelegate : NSObject - (instancetype)initWithVirtualMachine:(VZVirtualMachine *)virtualMachine windowWidth:(CGFloat)windowWidth