In the original IOS version of my app, the following code successfully opens settings:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:^(BOOL success)
{
...
}];
But after building for Catalyst the command does nothing on the mac. The command does execute, the completion handler fires, and success
is set to TRUE
. But it does not open the settings window.
How do I programmatically open the settings on Mac Catalyst?
Do you want to open your app’s settings or the macOS System Preferences?
The URL you’re using above opens the iOS Settings app To show your app’s settings, as specified in your Settings.bundle. On macOS, Catalyst apps will automatically create an in-app Preferences window for you from the Settings.bundle. Read more here: https://developer.apple.com/documentation/uikit/mac_catalyst/displaying_a_preferences_window
If you want to open System Preferences, you may be able to do it via openURL using one of these URLs: https://www.mbsplugins.de/archive/2020-04-05/MacOS_System_Preference_Links