Armando Couto
Armando Couto

Reputation: 41

flutter_inappwebview with iOS 16

Launching lib/main.dart on iPhone 14 Pro Max in debug mode... Running pod install... Running Xcode build... Xcode build done. 13,0s Failed to build iOS app Error output from Xcode build: ↳ ** BUILD FAILED **

Xcode's output: ↳ Writing result bundle at path: /var/folders/1w/tncq7cqs7wdblnbp_f35d_s00000gp/T/flutter_tools.SQyxcZ/flutter_ios_build_temp_dirC9UeU4/temporary_xcresult_bundle

/Users/usuario/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/ios/Classes/Types/UserScript.swift:13:6: error: stored properties cannot be marked potentially unavailable with '@available'
    @available(iOS 14.0, *)
     ^
error: the following command failed with exit code 1 but produced no further output
CompileSwift normal x86_64 /Users/usuario/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/ios/Classes/Types/UserScript.swift (in target 'flutter_inappwebview' from project 'Pods')
/Users/usuario/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/ios/Classes/Types/UserScript.swift:13:6: error: stored properties cannot be marked potentially unavailable with '@available'
    @available(iOS 14.0, *)
     ^
note: Building targets in dependency order
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')

Result bundle written to path:
    /var/folders/1w/tncq7cqs7wdblnbp_f35d_s00000gp/T/flutter_tools.SQyxcZ/flutter_ios_build_temp_dirC9UeU4/temporary_xcresult_bundle

Swift Compiler Error (Xcode): Stored properties cannot be marked potentially unavailable with '@available' /Users/usuario/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/ios/Classes/Types/UserScript.swift:12:5

Version: flutter_inappwebview: ^5.4.3+7

Upvotes: 4

Views: 3441

Answers (2)

Hermann Klecker
Hermann Klecker

Reputation: 14068

It is a know issue in flutter_inappwebview, or three of them: https://github.com/pichillilorenzo/flutter_inappwebview/issues/1216 https://github.com/pichillilorenzo/flutter_inappwebview/issues/1310 https://github.com/pichillilorenzo/flutter_inappwebview/issues/1312

There is already a PR aiming to fix the issue: https://github.com/pichillilorenzo/flutter_inappwebview/pull/1314

I suggest to wait for the PR to be released and for the meantime to raise the Deployment Target to 14. It worked for me.

I found suggestions for setting the deployment target in the podfile only. Not sure if it is helpful to have contradicting settings in the podfile and in the project.pbxproj of the Xcode project.

However, if you want to go to a forked package, then follow Alexandr's suggestion. It seems that the change was done already in that fork. https://github.com/CodeEagle/flutter_inappwebview

Upvotes: 1

Alexandr Priezzhev
Alexandr Priezzhev

Reputation: 1513

Before the package is fixed in the repository you can override it with a fixed version from GitHub. To do it edit your pubspec.yaml:

...

dependency_overrides:
  ...
  flutter_inappwebview:
    git: https://github.com/CodeEagle/flutter_inappwebview
  ...

Upvotes: 3

Related Questions