react-native-mapbox-gl icon indicating copy to clipboard operation
react-native-mapbox-gl copied to clipboard

Can't use react-native-mapbox-gl and MapboxNavigation with CocoaPods

Open ClementPF opened this issue 5 years ago • 7 comments

Mapbox Navigation SDK version: 0.29.1 react-native-mapbox-gl 6.1.3

Hello, I'm having an issue trying to use the Mapbox iOS Navigation along with the react-native-mapbox-gl module with CocoaPods.

Trying to use them together throws [!] The 'Pods-abcd' target has frameworks with conflicting names: mapbox.framework.

Steps to reproduce:

  1. react-native init abcd
  2. cd abcd && npm install @mapbox/react-native-mapbox-gl --save
  3. cd ios && touch Podfile
  4. Copy the following into the Podfile located abcd/ios/Podfile
platform :ios, '9.0'

target 'abcd' do

  use_frameworks!
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'CxxBridge', # Include this for RN >= 0.47
    'RCTImage'
    # Add any other subspecs you want to use in your project
  ]
  # Explicitly include Yoga if you are using RN >= 0.42.0
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  # Third party deps podspec link
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  # Mapbox
  pod 'react-native-mapbox-gl', :path => '../node_modules/@mapbox/react-native-mapbox-gl'
  pod 'MapboxNavigation', '~> 0.29.0'
end
  1. pod install
  2. Notice [!] The 'Pods-abcd' target has frameworks with conflicting names: mapbox.framework. preventing the creation of the .xcworkspace

Expected behavior:

The two SDKs should be able to be used together.

Thanks !

ClementPF avatar Mar 11 '19 22:03 ClementPF

The incompatibility reported by CocoaPods is caused by the fact that RNMBGL is distributed as Mapbox.framework, which happens to be the same bundle name that the Mapbox Maps SDK for iOS uses:

https://github.com/nitaliano/react-native-mapbox-gl/blob/e4b825275988e9054112139af1f31ad015fa4cf0/react-native-mapbox-gl.podspec#L16

CocoaPods requires each framework embedded within an iOS application target to have a distinct name. (This is a best practice for iOS applications in general.) This error affects any application that uses both RNMBGL and another iOS framework that depends on the iOS map SDK.

1ec5 avatar Mar 13 '19 14:03 1ec5

@1ec5 is there a quick fix for this on this lib's side? Ex: rename the Mapbox.framework to RNMapbox.framework ?

kristfal avatar Mar 18 '19 13:03 kristfal

We also encountered the naming conflict when trying to use navigation. @kristfal renaming the framework (and where it is referenced) in this lib should resolve the issue

mysport12 avatar Mar 18 '19 16:03 mysport12

This issue is related to #1533

mysport12 avatar Mar 18 '19 16:03 mysport12

@mysport12 if you have a workable approach, can you open a PR against #1533 with your additions? With these changes, I agree it makes sense to push towards a pod based installation of this repo.

kristfal avatar Mar 18 '19 17:03 kristfal

@ClementPF hi, have you already solved the problem, could you please tell how you solve it, I am still struggling with it.

Jackyaung avatar Jun 14 '19 08:06 Jackyaung

@ClementPF hi, have you already solved the problem, could you please tell how you solve it, I am still struggling with it.

I have not solved the problem.

ClementPF avatar Jul 10 '19 00:07 ClementPF