type argument ‘nw_proxy_config_t‘ is neither an Objective-C object nor a block type

回答 3 浏览 4303 2023-09-27

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

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

flutter run 
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 
Antonio Cardenas 提问于2023-09-27
3 个回答
#1楼 已采纳
得票数 15

修复:从 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,

__IPHONE_OS_VERSION_MAX_ALLOWED从170000更改为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

解决方法 3 更新

CocoaPods

gem install cocoapods 

并运行:

flutter clean 

flutter upgrade

cd ios && pod repo update

flutter run 

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

Antonio Cardenas 提问于2023-09-28
desertnaut 修改于2023-10-08
解决方法2有效Abdelrahman Tareq 2023-09-30
发现!解决方法对我有用! (适用于 macOS)Dr.Kameleon 2023-10-24
#2楼
得票数 1

flutter_inappwebview 更新到 5.8.0 对我有用。

Manuel Tapia 提问于2023-10-11
该解决方法对我有用!bamossza 2023-10-28
#3楼
得票数 -1

我是这样决定的:

  1. 删除PodsPodfile.lock文件

  2. 删除pubspec.lock文件

  3. Flutter clean && pub get

  4. cd ios

  5. arch -x86_64 pod install

  6. 再次运行项目

user19955346 提问于2023-10-25