Skip to content

fix deprecated API calls in platform_util_mac.mm #43126

@ckerr

Description

@ckerr

We're using a handful of deprecated APIs in shell/common/platform_util_mac.mm:

  • NSWorkspaceLaunchAsync
  • NSWorkspaceLaunchDefault
  • NSWorkspaceLaunchWithErrorPresentation
  • NSWorkspaceLaunchWithoutActivation
  • openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:
2024-07-30T21:52:10.9156040Z ../../electron/shell/common/platform_util_mac.mm:44:30: error: 'NSWorkspaceLaunchDefault' is deprecated: first deprecated in macOS 11.0 - Use NSWorkspaceOpenConfiguration instead. [-Werror,-Wdeprecated-declarations]
2024-07-30T21:52:10.9156970Z    44 |   NSUInteger launchOptions = NSWorkspaceLaunchDefault;
2024-07-30T21:52:10.9157340Z       |                              ^
2024-07-30T21:52:10.9158250Z xcode_links/electron/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWorkspace.h:355:5: note: 'NSWorkspaceLaunchDefault' has been explicitly marked deprecated here
2024-07-30T21:52:10.9159220Z   355 |     NSWorkspaceLaunchDefault                  API_DEPRECATED("Use NSWorkspaceOpenConfiguration instead.", macos(10.3, 11.0)) = NSWorkspaceLaunchAsync,
2024-07-30T21:52:10.9159770Z       |     ^
2024-07-30T21:52:10.9161000Z ../../electron/shell/common/platform_util_mac.mm:46:22: error: 'NSWorkspaceLaunchWithoutActivation' is deprecated: first deprecated in macOS 11.0 - Use -[NSWorkspaceOpenConfiguration setActivates:NO] instead. [-Werror,-Wdeprecated-declarations]
2024-07-30T21:52:10.9161950Z    46 |     launchOptions |= NSWorkspaceLaunchWithoutActivation;
2024-07-30T21:52:10.9162290Z       |                      ^
2024-07-30T21:52:10.9163320Z xcode_links/electron/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWorkspace.h:350:5: note: 'NSWorkspaceLaunchWithoutActivation' has been explicitly marked deprecated here
2024-07-30T21:52:10.9164520Z   350 |     NSWorkspaceLaunchWithoutActivation        API_DEPRECATED("Use -[NSWorkspaceOpenConfiguration setActivates:NO] instead.", macos(10.3, 11.0)) = 0x00000200,
2024-07-30T21:52:10.9165110Z       |     ^
2024-07-30T21:52:10.9166550Z ../../electron/shell/common/platform_util_mac.mm:48:48: error: 'openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:' is deprecated: first deprecated in macOS 11.0 - Use -[NSWorkspace openURLs:withApplicationAtURL:configuration:completionHandler:] instead. [-Werror,-Wdeprecated-declarations]
2024-07-30T21:52:10.9167770Z    48 |   bool opened = [[NSWorkspace sharedWorkspace] openURLs:@[ ns_url ]
2024-07-30T21:52:10.9168220Z       |                                                ^
2024-07-30T21:52:10.9169420Z xcode_links/electron/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWorkspace.h:406:1: note: 'openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:' has been explicitly marked deprecated here
2024-07-30T21:52:10.9171660Z   406 | - (BOOL)openURLs:(NSArray<NSURL *> *)urls withAppBundleIdentifier:(nullable NSString *)bundleIdentifier options:(NSWorkspaceLaunchOptions)options additionalEventParamDescriptor:(nullable NSAppleEventDescriptor *)descriptor launchIdentifiers:(NSArray<NSNumber *> * _Nullable * _Nullable)identifiers API_DEPRECATED("Use -[NSWorkspace openURLs:withApplicationAtURL:configuration:completionHandler:] instead.", macos(10.10, 11.0));
2024-07-30T21:52:10.9172950Z       | ^
2024-07-30T21:52:10.9173980Z ../../electron/shell/common/platform_util_mac.mm:71:7: error: 'NSWorkspaceLaunchAsync' is deprecated: first deprecated in macOS 11.0 - When using NSWorkspaceOpenConfiguration, all launches are asynchronous. [-Werror,-Wdeprecated-declarations]
2024-07-30T21:52:10.9174930Z    71 |       NSWorkspaceLaunchAsync | NSWorkspaceLaunchWithErrorPresentation;
2024-07-30T21:52:10.9175340Z       |       ^
2024-07-30T21:52:10.9176170Z xcode_links/electron/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWorkspace.h:351:5: note: 'NSWorkspaceLaunchAsync' has been explicitly marked deprecated here
2024-07-30T21:52:10.9177260Z   351 |     NSWorkspaceLaunchAsync                    API_DEPRECATED("When using NSWorkspaceOpenConfiguration, all launches are asynchronous.", macos(10.3, 11.0)) = 0x00010000,
2024-07-30T21:52:10.9177790Z       |     ^
2024-07-30T21:52:10.9179130Z ../../electron/shell/common/platform_util_mac.mm:71:32: error: 'NSWorkspaceLaunchWithErrorPresentation' is deprecated: first deprecated in macOS 11.0 - Use -[NSWorkspaceOpenConfiguration setPromptsUserIfNeeded:YES] instead. [-Werror,-Wdeprecated-declarations]
2024-07-30T21:52:10.9180350Z    71 |       NSWorkspaceLaunchAsync | NSWorkspaceLaunchWithErrorPresentation;
2024-07-30T21:52:10.9180720Z       |                                ^
2024-07-30T21:52:10.9181720Z xcode_links/electron/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWorkspace.h:347:5: note: 'NSWorkspaceLaunchWithErrorPresentation' has been explicitly marked deprecated here
2024-07-30T21:52:10.9182980Z   347 |     NSWorkspaceLaunchWithErrorPresentation    API_DEPRECATED("Use -[NSWorkspaceOpenConfiguration setPromptsUserIfNeeded:YES] instead.", macos(10.3, 11.0)) = 0x00000040,
2024-07-30T21:52:10.9183670Z       |     ^
2024-07-30T21:52:10.9185360Z ../../electron/shell/common/platform_util_mac.mm:72:49: error: 'openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:' is deprecated: first deprecated in macOS 11.0 - Use -[NSWorkspace openURLs:withApplicationAtURL:configuration:completionHandler:] instead. [-Werror,-Wdeprecated-declarations]
2024-07-30T21:52:10.9186710Z    72 |   BOOL success = [[NSWorkspace sharedWorkspace] openURLs:@[ url ]
2024-07-30T21:52:10.9187110Z       |                                                 ^
2024-07-30T21:52:10.9188440Z xcode_links/electron/MacOSX14.0.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWorkspace.h:406:1: note: 'openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:' has been explicitly marked deprecated here
2024-07-30T21:52:10.9190960Z   406 | - (BOOL)openURLs:(NSArray<NSURL *> *)urls withAppBundleIdentifier:(nullable NSString *)bundleIdentifier options:(NSWorkspaceLaunchOptions)options additionalEventParamDescriptor:(nullable NSAppleEventDescriptor *)descriptor launchIdentifiers:(NSArray<NSNumber *> * _Nullable * _Nullable)identifiers API_DEPRECATED("Use -[NSWorkspace openURLs:withApplicationAtURL:configuration:completionHandler:] instead.", macos(10.10, 11.0));
2024-07-30T21:52:10.9192440Z       | ^

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions