react-native-bluetooth-serial icon indicating copy to clipboard operation
react-native-bluetooth-serial copied to clipboard

Error IOS

Open thinh2408 opened this issue 5 years ago • 10 comments

'React/RCTBridgeModule.h' file not found

thinh2408 avatar Aug 28 '19 08:08 thinh2408

This is not an issue with the library, this is a React issue. It could be many things. It could be a PodFile issue, a Pods and React modules running in parallel issue, etc. But, this isn't an issue with the library itself. If you can, I'd try running it on just Android. It'll probably be okay!

arevaldez avatar Sep 23 '19 01:09 arevaldez

@arevaldez how can I fix it? My project use react-native 0.61 which doesn't have React podfile

datvp09 avatar Oct 15 '19 08:10 datvp09

@datvp09 you have to install the pod files. Typically by going into the iOS folder and running pod install

arevaldez avatar Oct 15 '19 12:10 arevaldez

I have the same issue, any idea?

nvdnvd00 avatar Nov 05 '19 07:11 nvdnvd00

I have the same issue on react native 0.61, i got it to work with older react native versions

afrakhan123 avatar Dec 29 '19 19:12 afrakhan123

I figured out how to resolve the issue. Btw, here is how to make this repository available to install via pods.

  1. Remove all ios native dependencies of this module.

  2. In the folder {YOUR_PROJECT}/node_modules/react-native-bluetooth-serial add file react-native-bluetooth-serial.podspec

  3. Insert into newly created file follow content:

require 'json'

package = JSON.parse(File.read(File.join(__dir__, 'package.json')))

Pod::Spec.new do |s|
  s.name         = package['name']
  s.version      = package['version']
  s.summary      = package['description']
  s.license      = package['license']

  s.authors      = package['author']
  s.homepage     = package['homepage']
  s.platform     = :ios, "9.0"

  s.source       = { :git => "https://github.com/rusel1989/react-native-bluetooth-serial.git", :tag => "v#{s.version}" }
  s.source_files  = "ios/**/*.{h,m}"

  s.dependency 'React'
end
  1. Fix file {YOUR_PROJECT}/node_modules/react-native-bluetooth-serial/ios/RCTBluetoothSerial/RCTBluetoothSerial.h, above line

#import <React/RCTBridgeModule.h>

add follow import #import <React/RCTBridge.h>

Finally it should be like this

...
#import <React/RCTBridge.h> // NEWLY ADDED LINE
#import <React/RCTBridgeModule.h>
...
  1. Make clean build folder

  2. In root of your project enter ios folder and make pod install

If all okay, the project should finally builds.

@rusel1989 Could you approve above changes to repository please? At least add pod file?

patroldo avatar Feb 28 '20 10:02 patroldo

I have the same issue on react native 0.61, i got it to work with older react native versions

@afrakhan123 May I ask which version of React-native you're using?

WhaSukGO avatar Mar 27 '20 16:03 WhaSukGO

The same issue here with React Native 0.63.2. Any solution?

arlovip avatar Aug 13 '20 02:08 arlovip

@patroldo I tried your solution, and now I get 'React/RCTBridge.h' file not found error when I try to build. Do you know why it might happen?

keselme90 avatar Apr 26 '21 10:04 keselme90

@lchenfox did you find a solution?

keselme90 avatar May 04 '21 10:05 keselme90