Skip to content

upgradeKnownHostsToHTTPS "unrecognized selector" #2741

@kwang87

Description

@kwang87

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

On macOS 11.7.10 (Big Sur), the app crashes when WKWebViewConfiguration.upgradeKnownHostsToHTTPS is accessed.
The following runtime error occurs:

-[WKWebViewConfiguration setUpgradeKnownHostsToHTTPS:]: unrecognized selector sent to instance

This happens even though the code is wrapped with if #available(macOS 11.3, *).

Expected Behavior

The WebView should initialize normally without crashing, and the configuration should skip applying upgradeKnownHostsToHTTPS on systems where the API is not supported.

Steps with code example to reproduce

if #available(macOS 11.3, *) {
configuration.upgradeKnownHostsToHTTPS = settings.upgradeKnownHostsToHTTPS
}
Or:

if #available(macOS 11.3, *) {
if newSettingsMap["upgradeKnownHostsToHTTPS"] != nil &&
settings?.upgradeKnownHostsToHTTPS != newSettings.upgradeKnownHostsToHTTPS {
configuration.upgradeKnownHostsToHTTPS = newSettings.upgradeKnownHostsToHTTPS
}
}
Running this code on macOS 11.7.10 causes an immediate crash due to the selector not existing in the WebKit runtime.

Stacktrace/Logs

-[WKWebViewConfiguration setUpgradeKnownHostsToHTTPS:]: unrecognized selector sent to instance

Flutter version

3.32.2

Operating System, Device-specific and/or Tool

macOS 11.7.10 (Big Sur, latest update)

Plugin version

6.2.0 beta v3

Additional information

No response

Self grab

  • I'm ready to work on this issue!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions