Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Duplicate interface definition for class 'RCTEventDispatcher' #3774

Open
simoes-agroleague opened this issue May 15, 2024 · 11 comments
Open

Comments

@simoes-agroleague
Copy link

Version

6.0.0

What platforms are you having the problem on?

iOS

Architecture

Old architecture

What happened?

I am experiencing the same issue than
Or in other words, changing node_modules/react-native-video/ios/Video/RCTVideo-Bridging-Header.h to:

The issue started on version 6.0.0-rc0 and I use react-native 0.73.6
I cannot modify the framework linkage static in the Podfile as it conflict with other libraries (Firebase for ex).

The only working fix is patching react-native-video/ios/Video/RCTVideo-Bridging-Header.h by adding the following import :
#import "RCTEventDispatcher.h"

Can you please integrate this import to the next version of react-native-video ?

Thanks !

Reproduction

repository link

Reproduction

Step to reproduce this bug are:

Install react-native-video v6.0.0 with react-native v0.73.6 and keep the same config has previously in the Podfile :

`pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec'`
@freeboub
Copy link
Collaborator

@simoes-agroleague but you need to remove:
pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec'
as explain here: https://thewidlarzgroup.github.io/react-native-video/updating
Did you try to remove this line ?

@mmorier
Copy link

mmorier commented May 16, 2024

@simoes-agroleague but you need to remove: pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec' as explain here: https://thewidlarzgroup.github.io/react-native-video/updating Did you try to remove this line ?

Yes I tested on my side and it was the same for me.

@freeboub
Copy link
Collaborator

I am not really confident in adding include which is unused ... (moreover I don't really understand what it do with linking).
BTW, I think I found a good fix for this.

I applied following patch in the sample which allows to use dynamic framework.

@@ -16,19 +16,30 @@ if linkage != nil
 end
 
 target 'videoplayer' do
   config = use_native_modules!
 
-  use_frameworks! :linkage => :static
+  use_frameworks! :linkage => :dynamic
 
   if ENV['RNV_SAMPLE_ENABLE_ADS']
     $RNVideoUseGoogleIMA = true
   end
   if ENV['RNV_SAMPLE_VIDEO_CACHING']
     $RNVideoUseVideoCaching = true
   end
 
+  pre_install do |installer|
+    installer.pod_targets.each do |pod|
+      if pod.name.eql?('react-native-video')
+        def pod.build_type
+          Pod::BuildType.static_library
+        end
+      end
+     end
+   end
+
   # Flags change depending on the env values.
   flags = get_default_flags()
 
   use_react_native!(
     :path => config[:reactNativePath],

I first update use_frameworks! :linkage => :dynamic -> I got a link issue, let say the issue is reproduced. (note that it was a missing symbol, not a a duplicate symbol).
Then I added the other part to force linkage of react native video as static, And now it works.

Can you please try to add the pre_install section in your app to se if it fixes the issue. If correct, I will update documentation.
Thank you

@freeboub
Copy link
Collaborator

@simoes-agroleague Did you test my proposal ?

@simoes-agroleague
Copy link
Author

Thanks for the proposition @freeboub.
I did not manage to set the use_frameworks! :linkage => :dynamic as another library I am using (RefinerSDK), doesn't resolve correctly.
For what it worths, without the use_frameworks the pre_install alone doesn't do the tricks, I got the same error.
I will keep the patch_package fix for now.

@freeboub
Copy link
Collaborator

@simoes-agroleague OK, thanks for the update.
Just to be clear, your expectation is to have no use_frameworks at all ?!

@simoes-agroleague
Copy link
Author

Exactly @freeboub

@freeboub freeboub added the ios label May 24, 2024
@freeboub
Copy link
Collaborator

@simoes-agroleague I just try to remove the use_frameworks in the sample app, It builds without issue 🙄
It is react 0.74 with xcode 15.3

@Roshdy
Copy link

Roshdy commented Jun 7, 2024

@freeboub so how should the rest of us do it :)
I'm using rn 0.72.5, i set the min_ios_override to 13.0

To make pod install run smoothly, i do the below:

# enable Video caching
  pod 'DVAssetLoaderDelegate', :modular_headers => true
  pod 'SPTPersistentCache', :modular_headers => true
  $RNVideoUseVideoCaching = true

my linkage is the standard react-native new app

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

and i override any modular headers like this

pod 'Firebase/Auth', :modular_headers => true
pod 'FirebaseAuth', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'Firebase', :modular_headers => true

I'm not sure if I should include the react-native-video to the modular_headers or not, but when i tried pods wouldn't install.

@freeboub
Copy link
Collaborator

freeboub commented Jun 7, 2024

@Roshdy you should try, but the issue described here is not a pod install issue, but a build issue ...
Did you double check the installation documentation for ios ?

@Roshdy
Copy link

Roshdy commented Jun 7, 2024

@freeboub yes i'm pod installing successfully now, but i'm getting Cannot find type 'RCTEventDispatcher' in scope in xcode @ react-antive-video/RCTVideo.swift

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants