Skip to content

openInWebView fails on iOS with simple call #71

@rubenstolk

Description

@rubenstolk

Calling the Capacitor InAppBrowser plugin’s openInWebView method on iOS fails with an invalid input parameters error, even when passing the minimal required arguments.

Steps to Reproduce

// Case 1: minimal call
Capacitor.Plugins.InAppBrowser.openInWebView({
  url: "https://google.com"
})

// Case 2: with empty options
Capacitor.Plugins.InAppBrowser.openInWebView({
  url: "https://google.com",
  options: {}
})

Expected Behavior

The call should open the URL inside a web view using default options, without requiring additional parameters.

Actual Behavior

Both calls fail with: The 'openInWebView' input parameters aren't valid.

Environment

  • Platform: iOS
  • Plugin: Capacitor InAppBrowser
  • Method: openInWebView

Notes

  • The error originates from the guard in the iOS implementation:
guard let options: OSInAppBrowserWebViewModel =
  self.createModel(for: call.getObject("options")) else {
    return self.error(call, type: .inputArgumentsIssue(target: .webView))
}

createModel(for:) returns nil for an empty object, so the call is always rejected unless a very specific options payload is provided.

Expected fix:

Either:

  • allow {} as valid input and fall back to default values, or
  • document which fields in options are required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions