nitaliano / react-native-mapbox-gl

A Mapbox GL react native module for creating custom maps
Other
2.16k stars 697 forks source link

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

Open ClementPF opened 5 years ago

ClementPF commented 5 years ago

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


5. `pod install`
6. 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 !
1ec5 commented 5 years ago

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.

kristfal commented 5 years ago

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

mysport12 commented 5 years ago

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 commented 5 years ago

This issue is related to #1533

kristfal commented 5 years ago

@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.

Jackyaung commented 5 years ago

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

ClementPF commented 5 years ago

@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.