flutter_inappwebview与iOS 16的兼容性

4
在调试模式下启动 lib/main.dart 在 iPhone 14 Pro Max 设备上... 正在运行 pod install... 正在运行 Xcode build... Xcode build 完成,用时 13.0 秒 iOS 应用构建失败 来自 Xcode 构建的错误输出: ↳ ** BUILD FAILED ** Xcode 输出: ↳ 在路径 /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编译器错误(Xcode):无法使用“@available”标记存储属性为可能不可用

/Users/usuario/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/ios/Classes/Types/UserScript.swift:12:5

版本:flutter_inappwebview:^5.4.3+7

2个回答

2
在软件包在仓库中被修复之前,您可以使用来自GitHub的固定版本来覆盖它。要这样做,请编辑您的pubspec.yaml文件:
...

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

1

在flutter_inappwebview中存在一个已知问题,或者说有三个问题: https://github.com/pichillilorenzo/flutter_inappwebview/issues/1216 https://github.com/pichillilorenzo/flutter_inappwebview/issues/1310 https://github.com/pichillilorenzo/flutter_inappwebview/issues/1312

已经有一个旨在解决此问题的PR: https://github.com/pichillilorenzo/flutter_inappwebview/pull/1314

我建议等待PR发布,同时将部署目标提高到14。这对我很有效。

我发现只有在podfile中设置部署目标的建议。不确定在Xcode项目的project.pbxproj和podfile中设置矛盾的设置是否有帮助。

但是,如果您想转到分叉软件包,则请遵循Alexandr的建议。看起来该更改已经在该分支中完成了。https://github.com/CodeEagle/flutter_inappwebview


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接