104

I am building an app by Flutter. I got this error message when doing "pod install" or "pod install --repo-update" or "pod update" and the pod install failed and stopped.

The error message:

[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod FirebaseCoreInternal-library depends upon GoogleUtilities-library, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set use_modular_headers! globally in your Podfile, or specify :modular_headers => true for particular dependencies.

My Podfile:

platform :ios, '11.0'

...

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

...
Ivan Tsaryk
  • 1,193
  • 2
  • 8
  • 10
  • 1
    Same issue when I upgrade my Xcode and Firebase version. Got any idea to solve this issue? I am trying to use another method to import firebase (xcode package manager), not sure if it works or not. – Hubert Wang Jun 07 '22 at 08:35
  • You can try the steps below, they helped me – Ivan Tsaryk Jun 08 '22 at 14:43
  • https://dev.to/matthewzruiz/firebase-the-following-swift-pods-cannot-yet-be-integrated-as-static-libraries-b59 – Chaki_Black Aug 14 '23 at 14:13

17 Answers17

217

You may not need to use use_frameworks! or use_modular_headers! because it's getting conflict with use_flipper

You can add the following without using them in ios/Podfile:

  platform :ios, '12.4'
  ...
  ...
  
  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true

Also Add this line for the FirebaseCore

  pod 'FirebaseCore', :modular_headers => true

  #....add any library need headers

Best

Community
  • 1
  • 1
Hussam Kurd
  • 8,066
  • 2
  • 43
  • 38
  • 2
    Doing this I get `target has transitive dependencies that include statically linked binaries` – Pablo Jul 13 '22 at 10:38
  • 6
    React Native: This will eventually stop working and break your app https://stackoverflow.com/a/74432488/14056591 – Ovidiu Cristescu Nov 15 '22 at 08:25
  • 1
    I am using `use_frameworks` and this solved the stated issue for me, as well as an issue with Firebase: https://github.com/invertase/react-native-firebase/issues/6403#issue-1308184812 – gabriellend Feb 17 '23 at 02:28
100

For newest version of firebase 15.1.1 with react-native 0.69.1 no need to enable use_frameworks because it will lead to errors in deploying in real devices

So you just need to add the firebase modulars and set headers to true.

     pod 'Firebase', :modular_headers => true
     pod 'FirebaseCore', :modular_headers => true
     pod 'GoogleUtilities', :modular_headers => true
     $RNFirebaseAsStaticFramework = true

And keep using flipper

  use_flipper!()

I tested it on both Android and IOS on real devices and it works great!

Here is what my Podfile looks like

require_relative '../node_modules/react-native/scripts/react_native_pods'
    require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
    
    platform :ios, '12.4'
    install! 'cocoapods', :deterministic_uuids => false
    
    target 'myApp' do
      config = use_native_modules!
      flags = get_default_flags()
        
      pod 'Firebase', :modular_headers => true
      pod 'FirebaseCore', :modular_headers => true
      pod 'GoogleUtilities', :modular_headers => true
      $RNFirebaseAsStaticFramework = true
    
    
      use_react_native!(
        :path => config[:reactNativePath],
        # to enable hermes on iOS, change `false` to `true` and then install pods
        :hermes_enabled => flags[:hermes_enabled],
        :fabric_enabled => flags[:fabric_enabled],
        # An absolute path to your application root.
        :app_path => "#{Pod::Config.instance.installation_root}/.."
      )
    
      target 'myAppTests' do
        inherit! :complete
        # Pods for testing
      end
    
      # Enables Flipper.
      #
      # Note that if you have use_frameworks! enabled, Flipper will not work and
      # you should disable the next line.
      use_flipper!()
    
      post_install do |installer|
        react_native_post_install(installer)
        __apply_Xcode_12_5_M1_post_install_workaround(installer)
      end
    end

-

UPDATED 20/Jul

If you wanted to use rich content notifications like notifications with images. Following this article by firebase will ask you to enable use_frameworks as well so my solution for that is to use modular_headers => true for the following packages

target 'richNotification' do
    pod 'FirebaseCoreInternal', :modular_headers => true
    pod 'Firebase/Messaging', :modular_headers => true
    pod 'GoogleUtilities', :modular_headers => true
end

NOTE: Make sure richNotification target is at the bottom of the podfile. see below how my final podfile looks like

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false

target 'MyApp' do
  config = use_native_modules!
  flags = get_default_flags()

#     use_frameworks! :linkage => :static
  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  $RNFirebaseAsStaticFramework = true
  # Flags change depending on the env values.


  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'MyAppTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

target 'richNotification' do
    pod 'FirebaseCoreInternal', :modular_headers => true
    pod 'Firebase/Messaging', :modular_headers => true
    pod 'GoogleUtilities', :modular_headers => true
end

I tested it on both Android and IOS, it works great!!

For Testing Send the following JSON data to https://fcm.googleapis.com/fcm/send as a"POST", and make sure to put in the headers "mutable-content": "1", See the screenshot below

{
        "to": " Put here your mobile fcm token ",
        "notification": {
            "title": "You have received a new request",
            "body": "Radiohead - Street Spirit (Fade Out)",
            "content_available" : "true",
            "priority" : "high",
            "sound":"defualt",
            "image": "https://i.ytimg.com/vi/LCJblaUkkfc/hq720.jpg"
        },
        "android": {
          "priority": "high",
          "notification": {
            "imageUrl": "https://www.youtube.com/watch?v=o3mP3mJDL2k"
          }
        },
        "apns": {
          "payload": {
            "aps": {
              "mutable-content": "1",
              "content-available": "true",
            },
            "imageUrl": "https://i.ytimg.com/vi/panR4xwt0wM/hqdefault.jpg",
            "fcm_options": {
              "imageUrl": "https://i.ytimg.com/vi/panR4xwt0wM/hqdefault.jpg"
            }
          },
          "headers": {
            "mutable-content": "1",
            "apns-push-type": "background",
            "apns-priority": "5", 
            "apns-topic": "com.paidtabs" 
          }
        },
        "webpush": {
          "headers": {
            "image": "https://koenig-media.raywenderlich.com/uploads/2021/01/good_news_petsicon.png"
          }
        },
        "data":{
          "passingDataToApp" : "Mario",
          "body" : "great match!",
          "Room" : "PortugalVSDenmark"
        }
      }

Headers look like headers

Liam
  • 6,517
  • 7
  • 25
  • 47
  • 5
    you sir are a legend, we need more people like you around here! – JonnySins666 Jul 30 '22 at 13:53
  • 3
    YOU ARE A FREAKING LEGEND MY GUY, I KEPT TYPING THE POD 'firebase'... stuff into terminal, my problem would've been fixed 4 days ago if people posted their podfile snippet. THANK YOU – Anteos1 Jul 31 '22 at 15:04
  • Is the advice to remove `use_frameworks!` suitable for Flutter (not React-Native)? Is there any documentation that explains what's going on with this? – fpsColton Oct 11 '22 at 21:18
  • Legend ... You are a legend :) I just spent 3 days find solution ... but it is a common thing. – Missa Constant May 18 '23 at 23:38
  • Integrating Firebase in 2023, I needed to add these: `pod 'Firebase', :modular_headers => true pod 'FirebaseCore', :modular_headers => true pod 'GoogleUtilities', :modular_headers => true pod 'FirebaseCoreExtension', :modular_headers => true pod 'FirebaseInstallations', :modular_headers => true pod 'GoogleDataTransport', :modular_headers => true pod 'nanopb', :modular_headers => true`. – Jiří Aug 01 '23 at 09:33
22

pod 'GoogleUtilities', :modular_headers => true;

add this line to podfile

Virluz
  • 469
  • 3
  • 6
17

Removing use_frameworks because is conflicting with use_flipper and adding all this libs worked for me

  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true  
  pod 'FirebaseStorageInternal', :modular_headers => true
  pod 'FirebaseCoreExtension', :modular_headers => true
  pod 'FirebaseAppCheckInterop', :modular_headers => true
  pod 'FirebaseAuthInterop', :modular_headers => true
  pod 'FirebaseMessagingInterop', :modular_headers => true
  pod 'GTMSessionFetcher', :modular_headers => true
  pod 'FirebaseAppCheckInterop', :modular_headers => true
  pod 'FirebaseAuthInterop', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true

Heads up! FirebaseFunctions-h.swift and FirebaseStorage-h.swift requires use_frameworks, so probably you may have an error with these files. Perhaps you may prefer use axios or similar lib to invoke your endpoint api and/or aws s3 to save your file instead.

C-lio Garcia
  • 652
  • 8
  • 17
  • Yup - after a day of attempts, the above worked. Honestly upgrading deps for ios is such a chore. – Adam Jul 24 '22 at 17:27
14

This worked for me too. @virluz just adding to your answer

Version of firebase 16.5 with react-native 70.5

Just add

pod 'GoogleUtilities', :modular_headers => true;

Between below code :

flags = get_default_flags()

    pod 'GoogleUtilities', :modular_headers => true;


  use_react_native!(
    :path => config[:reactNativePath],

After that you can run

arch -x86_64 pod install
Lonare
  • 3,581
  • 1
  • 41
  • 45
10

❗️ React Native developers:

I asked the maintainers of react-native-firebase about the solutions found here and they said the app will eventually break with these workarounds as modules are converted to Swift. FirebaseFunctions-h.swift and FirebaseStorage-h.swift already won't work. Here's the copy pasted answer:

that's an unsupportable workaround to avoid use_frameworks, it is temporarily working for you at best, does not work already if you use storage or functions modules, and other modules will stop working as they fully convert to Swift. I strongly discourage anyone from using that.

The correct solution is to incorporate use_frameworks and drop dependencies that don't support it or work in those repos that you cannot drop such that it is supported

Original answer: https://github.com/invertase/react-native-firebase/issues/6594#issuecomment-1303612795

EDIT: Here's also an official discussion from the React Native community: https://github.com/react-native-community/discussions-and-proposals/discussions/546#discussioncomment-4168642

Ovidiu Cristescu
  • 821
  • 7
  • 19
9

Regarding Expo managed, here's a config plugin that I've made, and works for me

const fs = require('fs');
const path = require('path');
const generateCode = require('@expo/config-plugins/build/utils/generateCode');
const configPlugins = require('@expo/config-plugins');

const code = `  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  $RNFirebaseAsStaticFramework = true`;

const withReactNativeFirebase = (config) => {
  return configPlugins.withDangerousMod(config, [
    'ios',
    async (config) => {
      const filePath = path.join(
        config.modRequest.platformProjectRoot,
        'Podfile'
      );
      const contents = fs.readFileSync(filePath, 'utf-8');

      const addCode = generateCode.mergeContents({
        tag: 'withReactNativeFirebase',
        src: contents,
        newSrc: code,
        anchor: /\s*get_default_flags\(\)/i,
        offset: 2,
        comment: '#',
      });

      if (!addCode.didMerge) {
        console.error(
          "ERROR: Cannot add withReactNativeFirebase to the project's ios/Podfile because it's malformed."
        );
        return config;
      }

      fs.writeFileSync(filePath, addCode.contents);

      return config;
    },
  ]);
};

module.exports = withReactNativeFirebase;
kvba
  • 309
  • 3
  • 8
  • 1
    You are a hero!!! Thanks a lot! Guys, more detailed info you can find here: https://docs.expo.dev/guides/config-plugins/ For this answer work: 1. Create a file in the root folder for example "firebase-fix.plugin.js" 2. Specify the plugin in the app.json. In "expo.plugins" add ["./expo-plugins/firebase-fix.plugin", "custom"] to plugins array (yes, add array in the array) – Максим Мартынов Sep 14 '22 at 13:02
  • 1
    thanks, add ["./expo-plugins/firebase-fix.plugin" ] in the plugin list works – gasolin Oct 05 '22 at 04:22
  • I am having trouble understanding how to implement this. Is there a way to show how this looks when added to your app.config.js file? I see the comments here and have read the docs on this but am still confused how to implement and where to put this file, and what associated files/configurations are necessary. – Starfs Dec 17 '22 at 16:55
9

None of the previously suggested solutions worked for me (I also use Expo), however, adding the following snippet to app.config.js solved it for me:

  1. Run npx expo install expo-build-properties
  2. In app.config.js add: <<<< CRITICAL STEP Referenced here
 plugins: [
      "@react-native-firebase/app",
      [
        "expo-build-properties",
        {
          ios: {
            useFrameworks: "static",
          },
        },
      ],
  1. My Podfile
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
require File.join(File.dirname(`node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules")

require 'json'
podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}

platform :ios, podfile_properties['ios.deploymentTarget'] || '12.4'
install! 'cocoapods',
  :deterministic_uuids => false

target 'ProjectName' do
  use_expo_modules!
  config = use_native_modules!

#   use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']

  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true  
  pod 'FirebaseStorageInternal', :modular_headers => true
  pod 'FirebaseCoreExtension', :modular_headers => true
  pod 'FirebaseAppCheckInterop', :modular_headers => true
  pod 'FirebaseAuthInterop', :modular_headers => true
  pod 'FirebaseMessagingInterop', :modular_headers => true
  pod 'GTMSessionFetcher', :modular_headers => true
  pod 'FirebaseAppCheckInterop', :modular_headers => true
  pod 'FirebaseAuthInterop', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => flags[:hermes_enabled] || podfile_properties['expo.jsEngine'] == 'hermes',
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Dir.pwd}/.."
  )

  # Uncomment to opt-in to using Flipper
  # Note that if you have use_frameworks! enabled, Flipper will not work
  #
  # if !ENV['CI']
  use_flipper!()
  # end

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    # This is necessary for Xcode 14, because it signs resource bundles by default
    # when building for devices.
    installer.target_installation_results.pod_target_installation_results
      .each do |pod_name, target_installation_result|
      target_installation_result.resource_bundle_targets.each do |resource_bundle_target|
        resource_bundle_target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
        end
      end
    end
  end

  post_integrate do |installer|
    begin
      expo_patch_react_imports!(installer)
    rescue => e
      Pod::UI.warn e
    end
  end
end
  1. Don't forget to cd ios && pod install
  2. Run your build, e.g. eas build --platform ios --profile development --local

RNFirebase versions

    "@react-native-firebase/analytics": "15.4",
    "@react-native-firebase/app": "15.4",
    "@react-native-firebase/auth": "15.4",
    "@react-native-firebase/crashlytics": "15.4",
    "@react-native-firebase/firestore": "15.4",
    "@react-native-firebase/perf": "15.4",
Michael Brenndoerfer
  • 3,483
  • 2
  • 39
  • 50
  • 2
    This works for expo managed projects! also can be referenced here https://github.com/invertase/react-native-firebase/issues/6332#issuecomment-1172950523 if it is a managed project you do NOT need to deal with all the podfile stuff. – Starfs Dec 17 '22 at 17:49
  • 2
    Managed workflow team user here. Doing steps 1 and 2 (removed "@react-native-firebase/app" and added quotes to ios and useFrameworks) resolved our EAS iOS build issue. Thank you – Mayhaffs Feb 27 '23 at 23:11
  • That's a valid answer, on top of those pods, from version `17.3.2` of `@react-native-firebase/*`, it'll ask you also for `FirebaseInstallations`, `GoogleDataTransport`, and `nanopb`. – Daniel Danielecki Mar 14 '23 at 07:47
8

Finally after going through so many questions the answer was to user Flipper and modular_header in same time, finally my Pod file looks like this :-

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false

target 'MyPregnancy' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()
  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
  
  target 'MyPregnancyTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end
Negm Sherif
  • 114
  • 3
3

Add to Podfile and update pod

  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers =>
true
  $RNFirebaseAsStaticFramework = true
3

I added only these 2 lines

  use_frameworks!
  use_modular_headers!

Podfile (IOS)

target 'Runner' do
  use_frameworks!
  use_modular_headers!
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
Samet ÖZTOPRAK
  • 3,112
  • 3
  • 32
  • 33
2

Add this in the Pod file before the target

use_frameworks! :linkage => :static

This is work well for React Native Application

Ali Abbas
  • 540
  • 4
  • 10
1

For native app projects, here's the Firebase Apple SDK Release Notes (Version 9.0.0):

CocoaPods Users

Breaking change: Podfiles must include use_frameworks! or use_frameworks! :linkage => :static.

Just add either line in your Podfile. The difference is explained in the document: Link Firebase dependencies statically or dynamically.

denkeni
  • 969
  • 1
  • 10
  • 22
0

Just a heads up for those desperately trying to fix this, using the newest packages, you may end up dealing with the warning "concurrency is only supported in IOS 15". That looks to be a dead end. It may be in your best interest to downgrade the package and wait for react native +70.0.

Noah Kanyo
  • 500
  • 1
  • 3
  • 8
  • I work with react native 0.71.11 but unfortunately none of the solutions above not worked for me. - Firebase versions: "@react-native-firebase/analytics": "^18.3.0", "@react-native-firebase/app": "^18.3.0", "@react-native-firebase/auth": "^18.3.0", "@react-native-firebase/messaging": "^18.3.0", – Akif Kara Aug 24 '23 at 20:13
0

For me the issue was simply because the version of the Podfile was not compatible with the new version of Firebase modules.

I am working on React Native, so the version of Podfile generated was not the latest one. Due to this my Firebase modules required something else in the Podfile.

It was an easy fix to add in the Podfile:

use_modular_headers!

However, you can also keep an eye on the history of your packages. I had React Native 0.69 that was released in June. I just checked the Firebase packaged version at that time and I have installed those ones. This works as well.

Matteo Galli
  • 645
  • 8
  • 12
0

I followed kvba 's config plugin. I'm forcing the FirebaseSDKVersion to 10.1.0:

const fs = require('fs')
const path = require('path')
const generateCode = require('@expo/config-plugins/build/utils/generateCode')
const configPlugins = require('@expo/config-plugins')

const code = `  $RNFirebaseAsStaticFramework = true

  # Override Firebase SDK Version
  $FirebaseSDKVersion = '10.1.0'`

const withReactNativeFirebase = config => {
  return configPlugins.withDangerousMod(config, [
    'ios',
    async config => {
      const filePath = path.join(config.modRequest.platformProjectRoot, 'Podfile')
      const contents = fs.readFileSync(filePath, 'utf-8')

      const addCode = generateCode.mergeContents({
        tag: 'withReactNativeFirebase',
        src: contents,
        newSrc: code,
        anchor: /\s*get_default_flags\(\)/i,
        offset: 2,
        comment: '#',
      })

      if (!addCode.didMerge) {
        console.error(
          "ERROR: Cannot add withReactNativeFirebase to the project's ios/Podfile because it's malformed.",
        )
        return config
      }

      fs.writeFileSync(filePath, addCode.contents)

      return config
    },
  ])
}

module.exports = withReactNativeFirebase

0
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false

target 'SeRemo' do
  config = use_native_modules!
  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  $RNFirebaseAsStaticFramework = true
  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => true,
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => FlipperConfiguration.enabled,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'SeRemoTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enable`enter code here`d => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end
  • 1
    While this code may solve the question, [including an explanation](//meta.stackexchange.com/q/114762) of how and why this solves the problem would really help to improve the quality of your post. Remember that you are answering the question for readers in the future, not just the person asking now. Please [edit] your answer to add explanations and give an indication of what limitations and assumptions apply. – Machavity Apr 26 '23 at 21:41