Search code examples
iosfluttercode-signingxcode15macos-sonoma

Uncategorized (Xcode): Command CodeSign failed with a nonzero exit code


Image of the Error help me out here As soon as Updated to the latest Xcode 15, I started getting this error.

I also Updated my mac to sonoma os .I have been stuck on this error for 3 days now and tried everything.

Flutter Code was working fine over Xcode 14.

Pod update pod install pod degenerated and installed again The IOS folder was deleted and then made again using Flutter Create.

Noting Works Help me here.


Solution

  • Try adding this in your podfile:

    xcode_base_version = `xcodebuild -version | grep 'Xcode' | awk '{print $2}' | cut -d . -f 1`
    
      post_install do |installer|
        installer.pods_project.targets.each do |target|
          target.build_configurations.each do |config|
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
            # For xcode 15+ only
             if config.base_configuration_reference && Integer(xcode_base_version) >= 15
              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
      end

    If you already have a post_install do |installer|, add only the if condition along with the end.