Search code examples
iosflutterxcodecocoapodsios17

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


Cannot build on latest Xcode 15 Stable, iOS 17 stable

Related to 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 

Solution

  • Fix: Upgrade flutter from master branch, delete podfile.lock and rerun pod install

    Temporal fix:

    Workaround 1 from GitHub:

    Use sudo and yor favorite text editor:

    open /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebsiteDataStore.h,
    

    change the __IPHONE_OS_VERSION_MAX_ALLOWED from 170000 to 180000

    Workaround 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
    
    

    Workaround 3 update

    CocoaPods

    gem install cocoapods 
    

    and run :

    flutter clean 
    
    flutter upgrade
    
    cd ios && pod repo update
    
    flutter run 
    

    Extra :

    Update flutter_inappwebview to latest version ^5.8.0
    

    And the project must build without problems