flutter 升级xcode15 问题修复

628 阅读1分钟

1、 Could not build module ‘WebKit’**

报错信息:

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/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebsiteDataStore.h

将里面的 170000 修改成 180000。

因为该文件是锁定状态,直接修改不了,需拷贝出来修改完成之后,再去替换该文件。

2、Assertion failed

报错信息:

Assertion failed: (false && “compact unwind compressed function offset doesn’t fit in 24 bits”), function operator(), file Layout.cpp,

解决方案:

Other Link Flags 添加 -ld64

路径:

Build Settings -> Linking - General -> Other Link Flags 添加 -ld64

3、 switch 编译报错

解决方案: 补全对应的 case分支

4、 升级获取网络类型 ios17以下系统 野指针闪退

解决方案: 升级

  #获取前网络类型
  connectivity_plus: ^5.0.2

5、 找不到flutter_keychain framework

解决方案: 升级

 # iOS Keychain持久存储
  flutter_keychain: ^2.4.0

6、 TOOLCHAIN_DIR 错误

解决方案: post_install do |installer| 下一行增加

  # 升级xcode15增加
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
    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