react-native-maps / react-native-maps

React Native Mapview component for iOS + Android
MIT License
15.05k stars 4.85k forks source link

Get "Multiple Commands Produce..." error when pod item added to Podfile #5155

Closed phazei closed 4 days ago

phazei commented 2 weeks ago

Summary

I have a brand new project with RN0.73. There's nothing but the initial setup. But the moment I add

pod 'react-native-google-maps', :path => '../../../node_modules/react-native-maps'

to the Podfile, then I start getting these errors:

Showing Recent Issues
Multiple commands produce '/Users/username/Library/Developer/Xcode/DerivedData/MyAppReactNative-bnjbcoaddnmndqgeccahaaugsint/Build/Intermediates.noindex/ArchiveIntermediates/MyAppReactNative/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/RCT-Folly_privacy.bundle'

Multiple commands produce '/Users/username/Library/Developer/Xcode/DerivedData/MyAppReactNative-bnjbcoaddnmndqgeccahaaugsint/Build/Intermediates.noindex/ArchiveIntermediates/MyAppReactNative/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/React-Core_privacy.bundle'

Reproducible sample code

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!

# $RNFirebaseAnalyticsWithoutAdIdSupport=true

# React Native Maps dependencies
pod 'react-native-google-maps', :path => '../../../node_modules/react-native-maps'
# additionally needs this or doesn't find header files in the react-native-maps/ios/AirMaps dir
pod 'react-native-maps', :path => '../../../node_modules/react-native-maps'

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

abstract_target 'Abstract' do
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  # Main app target
  target 'MyAppReactNative' do
    # Pods specific to the main app, if any

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

  # Share extension target
  # target 'MyAppShareExtension' do
  #   # Pods specific to the share extension, if any
  # end

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )

    installer.pods_project.targets.each do |target|

      target.build_configurations.each do |config|
        # Set APPLICATION_EXTENSION_API_ONLY to 'YES' for the share extension target and its dependencies.
        # This restricts API usage to only those safe for app extensions, preventing use of unavailable APIs like UIApplication.sharedApplication.
        # It helps catch potential extension-incompatible code at compile-time rather than runtime.
        config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = target.name.include?('MyAppShareExtension') ? 'YES' : 'NO'
      end
    end

  end

end

Steps to reproduce

New project, just adding react-native-maps to Podfile

Expected result

It Archives the same as before

Actual result

It gives errors.

React Native Maps Version

1.18.0

What platforms are you seeing the problem on?

iOS (Google Maps)

React Native Version

0.73.9

What version of Expo are you using?

Not using Expo

Device(s)

MacBook

Additional information

No response

VeladzicS commented 5 days ago

Per react native maps documentation: "Add the following to your Podfile above the use_native_modules! function and run pod install in the ios folder:"

You need to move where you place your react native maps dependencies bellow "abstract_target 'Abstract' do" and above "config = use_native_modules!".

Hope this helps you.

phazei commented 4 days ago

That fixed it!