Skip to content

Fixed Xcode 16 build failed error: method does not override any method from its superclass#2274

Closed
andychucs wants to merge 2 commits intopichillilorenzo:masterfrom
andychucs:master
Closed

Fixed Xcode 16 build failed error: method does not override any method from its superclass#2274
andychucs wants to merge 2 commits intopichillilorenzo:masterfrom
andychucs:master

Conversation

@andychucs
Copy link
Copy Markdown

@andychucs andychucs commented Sep 12, 2024

20th September 2024 Update:

WARNING: this change will cause Xcode 15 build errors if you still want to compile by old versions, do not use it. I am working on how to fix that now, if anyone knows a workaround, please let me know or just open a pr.
Because of that I made another version to fix it, please try to change ref to xcode-15-fix and report how it works.
andychucs#3


I made a few different changes based on other pr.I keep the override function evaluateJavaScript as public instead of delete or change as open.

Before the maintainer fixes it, add this in pubspec.yaml.

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

If you need it in the macOS app, also update your dependencies to include:

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

Connection with issue(s)

Resolve issue #2221 #2278 #2279 #2201

Connected to #???

Testing and Review Notes

WARNING: this change may cause Xcode 15 build errors if you still want to compile by old versions, do not use it. I am working on how to fix that now, if anyone knows a workaround, please let me know or just open a pr.

Screenshots or Videos

To Do

  • double check the original issue to confirm it is fully satisfied
  • add testing notes and screenshots in PR description to help guide reviewers
  • request the "UX" team perform a design review (if/when applicable)

@muric-dev
Copy link
Copy Markdown

Hey, nice to see your PR, just as a comment, there's another PR solving this issue:

https://github.com/pichillilorenzo/flutter_inappwebview/pull/2241/files

@andychucs
Copy link
Copy Markdown
Author

I missed checking the same code to the macOS module.
Thanks for fixing this issue @dhirajhimani .

@SzymonDziak
Copy link
Copy Markdown

please ping me when this is resolved

@kekland kekland mentioned this pull request Sep 18, 2024
2 tasks
@nabiarshad
Copy link
Copy Markdown

please ping me when this is resolved

Copy link
Copy Markdown

@ming-chu ming-chu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thank you!

@czegarram
Copy link
Copy Markdown

please ping me when this is resolved

@ueman
Copy link
Copy Markdown
Contributor

ueman commented Sep 19, 2024

These changes will fail on Xcode version lower than 16 due to the same error this is trying to fix. I'm guessing you need to annotate the methods with @available(...) annotations

@andychucs
Copy link
Copy Markdown
Author

andychucs commented Sep 19, 2024

@ueman Thanks for comment.

I'm not sure if it's correct to add annotations. I don't have a lower version of Xcode to test now.

I have checked the developer docs. It looks like there haven't been any updates to evaluateJavaScript and there's no new extension of WKWebView for iOS 18.0. Is it just that Xcode 16 doesn't allow overriding without the @MainActor annotation? Or should we not override this function at all?

Maybe we should add an extension to InAppWebView to fix.

@ueman
Copy link
Copy Markdown
Contributor

ueman commented Sep 19, 2024

After reading this https://stackoverflow.com/a/74364030, it seems you're right about not adding annotations. Instead, the code should be more explicit about the specific version of the method (at least I hope so, I haven't yet tested it)

@kalpeshp0310
Copy link
Copy Markdown

kalpeshp0310 commented Sep 19, 2024

I’m currently using Xcode 15, while my colleague is on Xcode 16. I can confirm that the changes in this PR resolved the build issues on Xcode 16. However, it breaks the build on Xcode 15 with the same error.

@andychucs
Copy link
Copy Markdown
Author

I’m currently using Xcode 15, while my colleague is on Xcode 16. I can confirm that the changes in this PR resolved the build issues on Xcode 16. However, it breaks the build on Xcode 15 with the same error.

@kalpeshp0310 Thanks for comment.
Can you paste the error message if possible?

@ming-chu
Copy link
Copy Markdown

@andychucs I am not sure if the Conditional-Compilation-Block can help.

@CPRmichel
Copy link
Copy Markdown

Can this PR be merged without pichillilorenzo ?

@kalpeshp0310
Copy link
Copy Markdown

I’m currently using Xcode 15, while my colleague is on Xcode 16. I can confirm that the changes in this PR resolved the build issues on Xcode 16. However, it breaks the build on Xcode 15 with the same error.

@kalpeshp0310 Thanks for comment. Can you paste the error message if possible?

Swift Compiler Error (Xcode): Method does not override any method from its superclass
/Users/kalpeshpatel/.pub-cache/git/flutter_inappwebview-615214fb2fd3f830955d526cfb6698d6e20b7b7a/flutter_inappwebview_ios/ios/Classes/InAppWebView/InAppWebView.swift:1431:25

Uncategorized (Xcode): Command SwiftCompile failed with a nonzero exit code

Could not build the application for the simulator.

@andychucs
Copy link
Copy Markdown
Author

andychucs commented Sep 19, 2024

Can you paste the WebKit.WKWebView code about evaluateJavaScript on Xcode 15?
And I made a different version of this fix, changing this func to private and renaming it. Can you try it on Xcode 15? ref: xcode-15-fix
@kalpeshp0310
截屏2024-09-19 23 22 52

@kalpeshp0310
Copy link
Copy Markdown

kalpeshp0310 commented Sep 19, 2024

@andychucs I could find a few references in WebKit.WKWebView.

Screenshot 2024-09-19 at 11 41 37 PM Screenshot 2024-09-19 at 11 42 16 PM

Also, the build is working fine on xcode-15-fix branch on Xcode-15. 👍

@ming-chu
Copy link
Copy Markdown

@kalpeshp0310 Thank you very much for the testing on Xcode 15! ❤️

@ueman
Copy link
Copy Markdown
Contributor

ueman commented Sep 23, 2024

Does this change is retro compatible with xcode 15 ?

No. Please read the above discussion and the update in the issue description to learn why

@pichillilorenzo
Copy link
Copy Markdown
Owner

Released new version 6.1.0 with the fix

@adamazlo
Copy link
Copy Markdown

Thank you!!!!!!

@fauzynurn
Copy link
Copy Markdown

Does this change is retro compatible with xcode 15 ?

No. Please read the above discussion and the update in the issue description to learn why

Just to clarify, so this is not backward compatibility with the xcode 15?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.