Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v6.1.0 fails to compile on Xcode 15 #2288

Closed
2 tasks done
ueman opened this issue Sep 23, 2024 · 15 comments
Closed
2 tasks done

v6.1.0 fails to compile on Xcode 15 #2288

ueman opened this issue Sep 23, 2024 · 15 comments
Labels
bug Something isn't working

Comments

@ueman
Copy link
Contributor

ueman commented Sep 23, 2024

  • I have read the Getting Started section
  • I have already searched for the same problem

Environment

Technology Version
Flutter version 3.24.0
Plugin version 6.1.0
Android version -
iOS version -
macOS version 14.6.1 (23G93)
Xcode version 15.2
Google Chrome version -

Device information:

Description

Expected behavior:

The plugin compiles

Current behavior:

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

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

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

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

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

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

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

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

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

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

Steps to reproduce

  1. Use Xcode 15.2 on 14.6.1 (I imagine any versions below that are also affected)
  2. Try to compile the app
  3. It runs into the error message listed above

I imagine it's due to thise issue: https://stackoverflow.com/questions/74364029/fatal-error-while-using-evaluatejavascript-on-wkwebview/74364030#74364030

@ueman ueman added the bug Something isn't working label Sep 23, 2024
Copy link

👋 @ueman

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!

@jmgeffroy
Copy link

jmgeffroy commented Sep 23, 2024

@ueman I had the same issue. I upgraded XCode 16 (still on MacOS 14.6.1 like you) and it works as expected

@ueman
Copy link
Contributor Author

ueman commented Sep 23, 2024

@ueman I had the same issue. I upgraded XCode 16 (still on MacOS 4.6.1 like you) and it works!

I know that it works on Xcode 16, but I can't yet update to Xcode 16

@pichillilorenzo
Copy link
Owner

Unfortunately, the changes made by the Apple/WebKit team won't work on < XCode 16.
I don't know if changing the signature of the WKWebView.evaluateJavaScript overridden method by this plugin will break other things, as it is used in some places.

@ueman
Copy link
Contributor Author

ueman commented Sep 23, 2024

I'm guessing the issue should be resolved if calls like these

are done with more parameters set explicitly. That removes ambiguity for the compiler.

I'm planning to test that, although not sure when I come around to that.

I don't think the change of the signature of the overriden method is incompatible with Xcode 15.

@Mixron469
Copy link

Mixron469 commented Sep 24, 2024

any update for this issues?

on my side, I forced to use flutter_inappwebview_ios to 1.0.13 and still have same issues

Failed to build iOS app
Swift Compiler Error (Xcode): Method does not override any method from its superclass
/Users/mod-cicd/.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/mod-cicd/.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/mod-cicd/.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/mod-cicd/.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/mod-cicd/.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/mod-cicd/.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/mod-cicd/.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/mod-cicd/.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/mod-cicd/.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/mod-cicd/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.0.13/ios/Classes/InAppWebView/InAppWebView.swift:2964:17
Encountered error while archiving for device.

@brennovich
Copy link

Related with #2294

@alisabry22
Copy link

I have the same issue on Xcode 15.2

@alisabry22
Copy link

@brennovich so what shall we do I read it but I didn't understand what I can do to solve it I have Xcode:15.4

flutter_inappwebview:[6.1.0]
Could not build the precompiled application for the device. Swift Compiler Error (Xcode): Method does not override any method from its superclass /Users/alisabry/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.1.0/ios/Classes/InAppWebView/InAppWebView.swift:1431:25

@pichillilorenzo
Copy link
Owner

#2221

@ueman Maybe __IPHONE_OS_VERSION_MAX_ALLOWED or __IPHONE_OS_VERSION_MIN_REQUIRED could be used?
Check: https://stackoverflow.com/a/8050536/4637638

@pichillilorenzo
Copy link
Owner

Released new flutter_inappwebview_ios and flutter_inappwebview_macos version 1.1.0+1 with the fix! I was able to use #if compiler(>=6.0) for Swift.
XCode 16 uses the Swift 6.0 compiler (more info here: https://xcodereleases.com/), so in the "else" statement we can use the "old" version of the "evaluateJavaScript" method.

You can run flutter pub upgrade to update the dependencies.

@andynewman10
Copy link

Thanks! It is working now.

Released new flutter_inappwebview_ios and flutter_inappwebview_macos version 1.1.0+1 with the fix! I was able to use #if compiler(>=6.0) for Swift. XCode 16 uses the Swift 6.0 compiler (more info here: https://xcodereleases.com/), so in the "else" statement we can use the "old" version of the "evaluateJavaScript" method.

I believe the offendling line (evaluateJavaScript) is actually about a SDK 17.2 vs 18 issue, not an Xcode (eg. Swift compiler) version issue.

While I don't think it is possible to use the 18 SDK with Xcode 15 (otherwise we would not have bothered you!), it might be possible to use the 17.2 SDK with Xcode 16. It is unlikely, though...

@tomsun
Copy link

tomsun commented Sep 26, 2024

You can run flutter pub upgrade to update the dependencies

@pichillilorenzo Awesome, thanks! My instinct though was to run flutter pub upgrade flutter_inappwebview, which was not enough to fix it: still 1.1.0 in the lockfile, still breaks on XCode 15.

Had to do flutter pub upgrade flutter_inappwebview_ios, even though my project does not directly depend on it

before that I also tried

dependency_overrides:
  flutter_inappwebview_ios: 1.1.0+1

...which also worked and felt more explicit

I did not want to do a blanket flutter pub upgrade and upgrade unrelated stuff

TL;DR you might still run into issues if your intuition tells you to just install / update to the latest flutter_inappwebview and you are still on XCode 15

@felipecastrosales
Copy link

Hello everyone! I opened an issue #2327 related to a new problem like this. I ask that you consider upvoting or interacting so that the maintainers can see this as soon as possible. Remember that these problems can happen to you - as is happening to me. :)

Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants