今天升级xcode14.0
问题1:
Could not build the precompiled application for the device.
Swift Compiler Error (Xcode): Stored properties cannot be marked potentially unavailable with '@available'
/Volumes/xxx/myshared/opt/fvm/versions/3.3.1/.pub-cache/hosted/pub.flutter-io.cn/flutter_inappwebview-5.4.3+7/ios/Classes/Types/UserScript.swift:12:5
Could not build the precompiled application for the device.
Swift Compiler Error (Xcode): Stored properties cannot be marked potentially unavailable with '@available'
/Volumes/huc/myshared/opt/fvm/versions/3.3.1/.pub-cache/hosted/pub.flutter-io.cn/flutter_inappwebview-5.4.3+7/ios/Classes/Types/UserScript.swift:12:5
方法1:
image.png image.png方法2:
修改Podfile
主要是这1行:
platform :ios, '14.0'
下面这行没雕用:
config.build_settings['SWIFT_VERSION'] = '5.0'
platform :ios, '14.0'
//省略
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
config.build_settings['SWIFT_VERSION'] = '5.0'
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
'AUDIO_SESSION_MICROPHONE=0',
'DISABLE_PUSH_NOTIFICATIONS=1'
]
end
end
end
最终方法:
以上就只能最低支持IOS14上运行了
回到报错原因:
Stored properties cannot be marked potentially unavailable with '@available'
image.png修改pubspec.yaml替换仓库地址:
dependency_overrides:
flutter_inappwebview:
git:
url: https://github.com/CodeEagle/flutter_inappwebview
将1、2操作的修改回到iOS11.0
platform :ios, '11.0'
image.png
image.png
OK 重新编译运行,没啥问题。
网友评论