app icon indicating copy to clipboard operation
app copied to clipboard

iOS: Ambiguous use of 'evaluateJavaScript(_:completionHandler:)'

Open Casuallynoted opened this issue 1 year ago • 6 comments

Getting these errors when building for iOS 18 via Xcode coming from flutter_inappwebview

Swift Compiler Error (Xcode): Method does not override any method from its superclass /Users/casuallynoted/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.0.13/ios/ Classes/InAppWebView/InAppWebView.swift:1431:25

Swift Compiler Error (Xcode): Ambiguous use of 'evaluateJavaScript(_:completionHandler:)' /Users/casuallynoted/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.0.13/ios/ Classes/InAppWebView/InAppWebView.swift:1035:20

Swift Compiler Error (Xcode): Ambiguous use of 'evaluateJavaScript(_:completionHandler:)' /Users/casuallynoted/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.0.13/ios/ Classes/InAppWebView/InAppWebView.swift:1038:16

Swift Compiler Error (Xcode): Ambiguous use of 'evaluateJavaScript(_:completionHandler:)' /Users/casuallynoted/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.0.13/ios/ Classes/InAppWebView/InAppWebView.swift:1047:20

Swift Compiler Error (Xcode): Ambiguous use of 'evaluateJavaScript(_:completionHandler:)' /Users/casuallynoted/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.0.13/ios/ Classes/InAppWebView/InAppWebView.swift:1050:16

Swift Compiler Error (Xcode): Ambiguous use of 'evaluateJavaScript(_:completionHandler:)' /Users/casuallynoted/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.0.13/ios/ Classes/InAppWebView/InAppWebView.swift:1327:25

Swift Compiler Error (Xcode): Ambiguous use of 'evaluateJavaScript(_:completionHandler:)' /Users/casuallynoted/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.0.13/ios/ Classes/InAppWebView/InAppWebView.swift:1912:8

Swift Compiler Error (Xcode): Ambiguous use of 'evaluateJavaScript(_:completionHandler:)' /Users/casuallynoted/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.0.13/ios/ Classes/InAppWebView/InAppWebView.swift:2859:22

Swift Compiler Error (Xcode): Ambiguous use of 'evaluateJavaScript(_:completionHandler:)' /Users/casuallynoted/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.0.13/ios/ Classes/InAppWebView/InAppWebView.swift:2870:22

Swift Compiler Error (Xcode): Ambiguous use of 'evaluateJavaScript(_:completionHandler:)' /Users/casuallynoted/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.0.13/ios/ Classes/InAppWebView/InAppWebView.swift:2964:17

Encountered error while archiving for device.

Casuallynoted avatar Sep 24 '24 05:09 Casuallynoted

Found the solution!

Add the following to your pubspec.yaml

dependencies:
  # rest of your dependencies ...
  flutter_inappwebview: ^6.0.0 

# Add the following dependency overrides for iOS & macOS, as needed -->
dependency_overrides:
  flutter_inappwebview_ios:
    git:
      url: https://github.com/andychucs/flutter_inappwebview.git
      ref: master
      path: flutter_inappwebview_ios

  flutter_inappwebview_macos:
    git:
      url: https://github.com/andychucs/flutter_inappwebview.git
      ref: master
      path: flutter_inappwebview_macos

Casuallynoted avatar Sep 24 '24 05:09 Casuallynoted

Getting this error now, it builds but freezes on a white screen at launch:

NSBundle file:///System/Library/PrivateFrameworks/MetalTools.framework/ principal class is nil because all fallbacks have failed
database path: /var/containers/Bundle/Application/6947D4DA-D405-49CD-8197-19FADBC62652/Runner.app/Frameworks/flutter_downloader.framework/FlutterDownloaderDatabase.bundle/download_tasks.sql
AllFilesDownloadedMessage: All files have been downloaded
flutter: The Dart VM service is listening on http://127.0.0.1:52463/LNVOTfuu_6w=/
fopen failed for data file: errno = 2 (No such file or directory)
Errors found! Invalidating cache...
fopen failed for data file: errno = 2 (No such file or directory)
Errors found! Invalidating cache...
*** Assertion failure in -[FlutterDownloaderPlugin startBackgroundIsolate:], FlutterDownloaderPlugin.m:145
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'failed to set registerPlugins'
*** First throw call stack:
(0x19e53d7cc 0x19b7ff2e4 0x19d90e9ac 0x105b0da08 0x105b13360 0x105b16718 0x109a63210 0x1094e4d88 0x10623ca30 0x10623e71c 0x10624ede8 0x10624e9a4 0x19e511204 0x19e50e440 0x19e50d830 0x1ea8251c4 0x1a107b9a4 0x1a112a168 0x1a1462478 0x1051acae4 0x1051aca5c 0x1051acb60 0x1c423dec8)
libc++abi: terminating due to uncaught exception of type NSException

Casuallynoted avatar Sep 24 '24 05:09 Casuallynoted

Also had to follow the setup instructions listed here to get flutter_downloadplugin to play nicely.

https://github.com/fluttercommunity/flutter_downloader

Casuallynoted avatar Sep 24 '24 06:09 Casuallynoted

Nice find! Do you want to send a PR?

kolaente avatar Sep 24 '24 09:09 kolaente

I’d love to! I’m away from home for the day but will try to get it submitted asap. If you don’t hear from me shoot me a reminder tomorrow and I’ll be home and able to put it in! :)

Casuallynoted avatar Sep 24 '24 09:09 Casuallynoted

@Casuallynoted thanks for the report! I don't have access to a mac so ios development will be pr-driven for the foreseeable future. So if you're able to provide one, I'm more than happy to merge it!

Benimautner avatar Sep 26 '24 11:09 Benimautner