1
1

More than 1 year has passed since last update.

【Flutter】 Stored properties cannot be marked potentially unavailable with '@available'の解決法

Posted at

xcodeを14.3に上げるとiosビルドが失敗する。。。

最初はこんなエラーでビルドが失敗しました。

Error (Xcode): File not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a

Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)

Could not build the application for the simulator.
Error launching application on iPhone 14 Pro Max.

どうやらこれはxcodeを14.3にアップしたからだそうです:frowning:

このエラー自体は解決したのですが、今度はまた別のエラーが発生しました。。。

flutter_inappwebviewが原因?でビルドが失敗。。

/Users/user/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/Types/UserScript.swift:13:6 Stored properties cannot be marked potentially unavailable with '@available'

どうやらアプリで使ってるwebviewのパッケージである「flutter_inappwebview」のバージョンが原因で発生しているっぽいです。。

上記の参考記事の中でPodFileに追加した部分である['IPHONEOS_DEPLOYMENT_TARGET']を13.0から14.0に変更することで解決できました:raised_hands:

ios/Podfile
post_install do |installer|
  installer.generated_projects.each do |project|
    project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'
      end
   end
  end
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
      config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
      config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
      config.build_settings['ENABLE_BITCODE'] = "YES"
      config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
    end
    if ['SwinjectStoryboard'].include? target.name
      target.build_configurations.each do |config|
        config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'NO'
      end
    end
  end
end

これで

pod install --repo-update

を実行すればOK!!

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1