🕸️

iPhone15(iOS17)でFlutterアプリがビルドできない問題を解決する

2023/09/20に公開

前提

XCode15にアップデートし、iPhone15(iOS17)でFlutterアプリをビルドし実行したい方、
Flutterアプリ内でflutter_inappwebviewを使ってる方が対象となります。
※エラー内容1の解決方法は上記外の方も対象

エラー内容1

Error (Xcode): DT_TOOLCHAIN_DIR cannot be used to evaluate LIBRARY_SEARCH_PATHS, use TOOLCHAIN_DIR instead

解決策1

これを参考にしてPodfileに下記を追加
https://github.com/CocoaPods/CocoaPods/issues/12012#issuecomment-1653051943

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)

    target.build_configurations.each do |config|
      # --- Fix for Xcode 15.0 ---
      xcconfig_path = config.base_configuration_reference.real_path
      xcconfig = File.read(xcconfig_path)
      xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
      File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
      # ---------------------------------
    end
  end
end

エラー内容2

Error (Xcode): type argument 'nw_proxy_config_t' (aka 'struct nw_proxy_config *') is neither an Objective-C object nor a block type
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.0.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebsiteDataStore.h:119:46

Parse Issue (Xcode): Could not build module 'WebKit'
/Users/xxxxx/Develop/git/xxxxxx/build/ios/Debug-iphonesimulator/flutter_inappwebview/flutter_inappwebview.framework/Headers/flutter_inappwebview-Swift.h:1162:8

解決策2

これを参考にしてflutter_inappwebviewをgithubから直接取得
https://github.com/pichillilorenzo/flutter_inappwebview/issues/1735#issuecomment-1725248033

  flutter_inappwebview: 
    git:
      url: https://github.com/Estrelio/flutter_inappwebview.git
      ref: fix-xcode-17

Discussion