类型参数“nw_proxy_config_t”既不是 Objective-C 对象也不是块类型

Ant*_*nas 16 xcode ios cocoapods flutter ios17

无法在最新的 Xcode 15 稳定版、iOS 17 稳定版上构建

相关 https://github.com/pichillilorenzo/flutter_inappwebview/issues/1735

flutter run 
Run Code Online (Sandbox Code Playgroud)
Could not build the precompiled application for the device.
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/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebsiteDataStore.h:119:46

Parse Issue (Xcode): Could not build module 'WebKit'
/build/ios/Debug-iphoneos/flutter_inappwebview/flutter_inappwebview.framework/Headers/flutter_inappwebview-Swift.h:285:8


Error launching application on iPhone 
Run Code Online (Sandbox Code Playgroud)

Ant*_*nas 20

修复:从 master 分支升级 flutter,删除 podfile.lock 并重新运行 pod install

时间修复:

来自 GitHub 的解决方法1:

使用 sudo 和您最喜欢的文本编辑器:

open /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebsiteDataStore.h,
Run Code Online (Sandbox Code Playgroud)

将 170000更改__IPHONE_OS_VERSION_MAX_ALLOWED为 180000

解决方法 2

post_integrate do |installer|
  compiler_flags_key = 'COMPILER_FLAGS'
  project_path = 'Pods/Pods.xcodeproj'

  project = Xcodeproj::Project.open(project_path)
  project.targets.each do |target|
    target.build_phases.each do |build_phase|
      if build_phase.is_a?(Xcodeproj::Project::Object::PBXSourcesBuildPhase)
        build_phase.files.each do |file|
          if !file.settings.nil? && file.settings.key?(compiler_flags_key)
            compiler_flags = file.settings[compiler_flags_key]
            file.settings[compiler_flags_key] = compiler_flags.gsub(/-DOS_OBJECT_USE_OBJC=0\s*/, '')
          end
        end
      end
    end
  end
  project.save()
end

Run Code Online (Sandbox Code Playgroud)

解决方法3更新

可可豆荚

gem install cocoapods 
Run Code Online (Sandbox Code Playgroud)

并运行:

flutter clean 

flutter upgrade

cd ios && pod repo update

flutter run 
Run Code Online (Sandbox Code Playgroud)

额外的 :

Update flutter_inappwebview to latest version ^5.8.0
Run Code Online (Sandbox Code Playgroud)

并且该项目必须构建没有问题

  • 解决方法2有效 (6认同)

小智 15

将flutter_inappwebview更新到 5.8.0 对我有用。