GRPC prbc.h classes not generated objective-c - objective-c

I am trying to use GRPC with react native. While basic helloWorld example is working fine with it. When i Added new request to hellowWorld.proto file its is not generating/updating Helloworld.prbc.h file.
helloworld.proto
syntax = "proto3";
option objc_class_prefix = "HLW";
package helloworld;
// The greeting service definition.
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloReply) {}
rpc HelloDev (HelloDevRequest) returns (HelloDevReply) {}
}
// The request message containing the user's name.
message HelloRequest {
string name = 1;
}
// The response message containing the greetings
message HelloReply {
string message = 1;
}
// The request message containing the user's name.
message HelloDevRequest {
string name = 1;
}
// The response message containing the greetings
message HelloDevReply {
string message = 1;
}
I tried:
pod install
after pod install i was expecting Helloworld.prbc.h to have defination for HelloDev.
Another way:
protoc --objc_out=Pods/ReactNativeGrpc --objcgrpc_out=Pods/ReactNativeGrpc helloworld.proto
ReactNativeGrpc is pod for my project
here is auto generated file from compiler (its same even after running pod install)
// Code generated by gRPC proto compiler. DO NOT EDIT!
// source: helloworld.proto
#import <Foundation/Foundation.h>
#if !defined(GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO) || !GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO
#import "Helloworld.pbobjc.h"
#endif
#if !defined(GPB_GRPC_PROTOCOL_ONLY) || !GPB_GRPC_PROTOCOL_ONLY
#import <ProtoRPC/ProtoService.h>
#import <ProtoRPC/ProtoRPCLegacy.h>
#import <RxLibrary/GRXWriteable.h>
#import <RxLibrary/GRXWriter.h>
#endif
#class HLWHelloReply;
#class HLWHelloRequest;
#if !defined(GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO) || !GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO
#endif
#class GRPCUnaryProtoCall;
#class GRPCStreamingProtoCall;
#class GRPCCallOptions;
#protocol GRPCProtoResponseHandler;
#class GRPCProtoCall;
NS_ASSUME_NONNULL_BEGIN
#protocol HLWGreeter2 <NSObject>
#pragma mark SayHello(HelloRequest) returns (HelloReply)
/**
* Sends a greeting
*/
- (GRPCUnaryProtoCall *)sayHelloWithMessage:(HLWHelloRequest *)message responseHandler:(id<GRPCProtoResponseHandler>)handler callOptions:(GRPCCallOptions *_Nullable)callOptions;
#end
/**
* The methods in this protocol belong to a set of old APIs that have been deprecated. They do not
* recognize call options provided in the initializer. Using the v2 protocol is recommended.
*/
#protocol HLWGreeter <NSObject>
#pragma mark SayHello(HelloRequest) returns (HelloReply)
/**
* Sends a greeting
*
* This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended.
*/
- (void)sayHelloWithRequest:(HLWHelloRequest *)request handler:(void(^)(HLWHelloReply *_Nullable response, NSError *_Nullable error))handler;
/**
* Sends a greeting
*
* This method belongs to a set of APIs that have been deprecated. Using the v2 API is recommended.
*/
- (GRPCProtoCall *)RPCToSayHelloWithRequest:(HLWHelloRequest *)request handler:(void(^)(HLWHelloReply *_Nullable response, NSError *_Nullable error))handler;
#end
#if !defined(GPB_GRPC_PROTOCOL_ONLY) || !GPB_GRPC_PROTOCOL_ONLY
/**
* Basic service implementation, over gRPC, that only does
* marshalling and parsing.
*/
#interface HLWGreeter : GRPCProtoService<HLWGreeter2, HLWGreeter>
- (instancetype)initWithHost:(NSString *)host callOptions:(GRPCCallOptions *_Nullable)callOptions NS_DESIGNATED_INITIALIZER;
+ (instancetype)serviceWithHost:(NSString *)host callOptions:(GRPCCallOptions *_Nullable)callOptions;
// The following methods belong to a set of old APIs that have been deprecated.
- (instancetype)initWithHost:(NSString *)host;
+ (instancetype)serviceWithHost:(NSString *)host;
#end
#endif
NS_ASSUME_NONNULL_END
PodFile:
platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
def add_flipper_pods!(versions = {})
versions['Flipper'] ||= '~> 0.33.1'
versions['DoubleConversion'] ||= '1.1.7'
versions['Flipper-Folly'] ||= '~> 2.1'
versions['Flipper-Glog'] ||= '0.3.6'
versions['Flipper-PeerTalk'] ||= '~> 0.0.4'
versions['Flipper-RSocket'] ||= '~> 1.0'
pod 'FlipperKit', versions['Flipper'], :configuration => 'Debug'
pod 'FlipperKit/FlipperKitLayoutPlugin', versions['Flipper'], :configuration => 'Debug'
pod 'FlipperKit/SKIOSNetworkPlugin', versions['Flipper'], :configuration => 'Debug'
pod 'FlipperKit/FlipperKitUserDefaultsPlugin', versions['Flipper'], :configuration => 'Debug'
pod 'FlipperKit/FlipperKitReactPlugin', versions['Flipper'], :configuration => 'Debug'
# List all transitive dependencies for FlipperKit pods
# to avoid them being linked in Release builds
pod 'Flipper', versions['Flipper'], :configuration => 'Debug'
pod 'Flipper-DoubleConversion', versions['DoubleConversion'], :configuration => 'Debug'
pod 'Flipper-Folly', versions['Flipper-Folly'], :configuration => 'Debug'
pod 'Flipper-Glog', versions['Flipper-Glog'], :configuration => 'Debug'
pod 'Flipper-PeerTalk', versions['Flipper-PeerTalk'], :configuration => 'Debug'
pod 'Flipper-RSocket', versions['Flipper-RSocket'], :configuration => 'Debug'
pod 'FlipperKit/Core', versions['Flipper'], :configuration => 'Debug'
pod 'FlipperKit/CppBridge', versions['Flipper'], :configuration => 'Debug'
pod 'FlipperKit/FBCxxFollyDynamicConvert', versions['Flipper'], :configuration => 'Debug'
pod 'FlipperKit/FBDefines', versions['Flipper'], :configuration => 'Debug'
pod 'FlipperKit/FKPortForwarding', versions['Flipper'], :configuration => 'Debug'
pod 'FlipperKit/FlipperKitHighlightOverlay', versions['Flipper'], :configuration => 'Debug'
pod 'FlipperKit/FlipperKitLayoutTextSearchable', versions['Flipper'], :configuration => 'Debug'
pod 'FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], :configuration => 'Debug'
end
# Post Install processing for Flipper
def flipper_post_install(installer)
installer.pods_project.targets.each do |target|
if target.name == 'YogaKit'
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.1'
end
end
end
end
target 'Hello' do
# Pods for Hello
pod 'ReactNativeGrpc', :path => '.'
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true
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'
target 'HelloTests' do
inherit! :complete
# Pods for testing
end
use_native_modules!
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
add_flipper_pods!
post_install do |installer|
flipper_post_install(installer)
end
end
target 'Hello-tvOS' do
# Pods for Hello-tvOS
target 'Hello-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
ReactNativeGRPC.Podspec:
Pod::Spec.new do |s|
s.name = "ReactNativeGrpc"
s.version = "0.0.1"
s.license = "Apache License, Version 2.0"
s.authors = { 'gRPC contributors' => 'grpc-io#googlegroups.com' }
s.homepage = "https://grpc.io/"
s.summary = "Example integration between react-native and GRPC"
s.source = { :git => 'https://github.com/grpc/grpc.git' }
s.ios.deployment_target = "7.1"
s.osx.deployment_target = "10.9"
# Base directory where the .proto files are.
src = "../proto"
# Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients.
s.dependency "!ProtoCompiler-gRPCPlugin", "~> 1.0"
# Pods directory corresponding to this app's Podfile, relative to the location of this podspec.
pods_root = 'Pods'
# Path where Cocoapods downloads protoc and the gRPC plugin.
protoc_dir = "#{pods_root}/!ProtoCompiler"
protoc = "#{protoc_dir}/protoc"
plugin = "#{pods_root}/!ProtoCompiler-gRPCPlugin/grpc_objective_c_plugin"
# Directory where the generated files will be placed.
dir = "#{pods_root}/#{s.name}"
s.prepare_command = <<-CMD
mkdir -p #{dir}
#{protoc} \
--plugin=protoc-gen-grpc=#{plugin} \
--objc_out=#{dir} \
--grpc_out=#{dir} \
-I #{src} \
-I #{protoc_dir} \
#{src}/helloworld.proto
CMD
# Files generated by protoc
s.subspec "Messages" do |ms|
ms.source_files = "#{dir}/*.pbobjc.{h,m}", "#{dir}/**/*.pbobjc.{h,m}"
ms.header_mappings_dir = dir
ms.requires_arc = false
# The generated files depend on the protobuf runtime.
ms.dependency "Protobuf"
end
# Files generated by the gRPC plugin
s.subspec "Services" do |ss|
ss.source_files = "#{dir}/*.pbrpc.{h,m}", "#{dir}/**/*.pbrpc.{h,m}"
ss.header_mappings_dir = dir
ss.requires_arc = true
# The generated files depend on the gRPC runtime, and on the files generated by protoc.
ss.dependency "gRPC-ProtoRPC"
ss.dependency "#{s.name}/Messages"
end
s.pod_target_xcconfig = {
# This is needed by all pods that depend on Protobuf:
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1',
# This is needed by all pods that depend on gRPC-RxLibrary:
'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
}
end
Want to use updated proto definition in code, that's not working here.
Edit 1: Cleaning and installing every time works but need alternative to avoid it.

Have you tried to clean Cocoapods cache? If not, try to run the following command to clean cache before running pod install:
rm -rf Pods
rm -rf (your_project).xcworkspace
rm Podfile.lock

Related

Build fail when using use_frameworks! react-native

I'm developing an app using React-native 0.59.1. But I've got an issue that I can not link a static library. In Podfile I am installing both frameworks and library using Cocapods.
Xcode will throw an error the library is not linked yet when Podfile contains the keyword use_framework!, but is successful if I remove this keyword.
Can you help me to fix it?
platform :ios, '10.0'
target 'Test_RN_0_59_1' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
rn_path = '../node_modules/react-native'
pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec"
pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"
pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/GLog.podspec"
pod 'React', path: rn_path, subspecs: [
'Core',
'CxxBridge',
'RCTAnimation',
'RCTActionSheet',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket',
'RCTPushNotification',
'RCTCameraRoll',
'RCTSettings',
'RCTBlob',
'RCTGeolocation',
'DevSupport'
]
pod 'rn-juicy-score', :path => '../node_modules/rn-juicy-score'
Capture
If you want to use static library with use_framework! in React Native, you can use the following solution:
...
pod 'rn-juicy-score', :path => '../node_modules/rn-juicy-score'
pre_install do |installer|
installer.pod_targets.each do |pod|
if pod.name.eql?('rn-juicy-score')
def pod.build_type
Pod::BuildType.static_library
end
end
end
end
Adding a condition in pre_install block would make sure your specified pod is built using static library and the rest are built using dynamic framework. This will allow you to use both build systems and configure according to requirement.
If you are using react native > 0.68.x, you need use use_frameworks!, you must to add in your Podfile this code:
$static_framework = ['Flipper-Boost-iOSX', 'Flipper-RSocket', 'glog', 'Yoga', 'YogaKit', 'React-logger', 'Flipper-Fmt', 'RCT-Folly', 'Flipper-Folly', 'React-jsi', 'FlipperKit', 'Flipper', 'Flipper-Glog', 'Flipper-PeerTalk', 'React-cxxreact', 'React-jsiexecutor', 'React-Core', 'React-RCTText', 'RCTTypeSafety', 'ReactCommon', 'React-Codegen', 'React-RCTVibration', 'React-RCTSettings', 'React-RCTNetwork', 'React-RCTLinking', 'React-RCTAnimation', 'React-RCTBlob', 'React-RCTImage', 'React-CoreModules']
pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
installer.pod_targets.each do |pod|
if $static_framework.include?(pod.name)
def pod.build_type;
Pod::BuildType.static_library
end
end
end
end
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:production => production,
:hermes_enabled => flags[:hermes_enabled],
:fabric_enabled => flags[:fabric_enabled],
#:flipper_configuration => FlipperConfiguration.enabled,
:flipper_configuration => FlipperConfiguration.enabled(["Release", "Debug"], { 'Flipper' => '0.127.0' }),
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
After that run pod install to update the changes. I tested this in Intel & M1 mac's.

React has been deprecated - React Native

I am creating an app using React Native and am trying to install cocoa pods for iOS but when I enter pod install into the terminal I get the following warning.
Then when I try to run my app in an iOS emulator it crashes and won't run.
Here is the Xcode error.
I am running react native 0.63.2.
Here is my pod file
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
require_relative '../node_modules/react-native/scripts/react_native_pods'
target 'Example' do
# Comment the next line if you don't want to use dynamic frameworks
#use_frameworks!
# Pods for Example
# pod 'React', :path => '../node_modules/react-native'
pod 'RNSound', :path => '../node_modules/react-native-sound'
pod 'RNCAsyncStorage', :path => '../node_modules/#react-native-community/async-storage'
pod 'RNCMaskedView', :path => '../node_modules/#react-native-community/masked-view'
pod 'RNCPushNotificationIOS', :path => '../node_modules/#react-native-community/push-notification-ios'
pod 'react-native-slider', :path => '../node_modules/#react-native-community/slider'
pod 'RNFBApp', :path => '../node_modules/#react-native-firebase/app'
pod 'RNFBAuth', :path => '../node_modules/#react-native-firebase/auth'
pod 'RNFBMessaging', :path => '../node_modules/#react-native-firebase/messaging'
pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'
pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'
pod 'react-native-safe-area-context', :path => '../node_modules/react-native-safe-area-context'
pod 'RNScreens', :path => '../node_modules/react-native-screens'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
target 'Example-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
target 'ExampleTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'Example-tvOS' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for Example-tvOS
end
The issue is that you don't install pod for the correctly target.
This is strange if this is a new RN project because it should take the correct target.
In you recently image added seems like you have another target called AntrimElimChurch so if you want to install pod for that target you should change it in PodFile as well
am running react native 0.63.2.
Here is my pod file
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
require_relative '../node_modules/react-native/scripts/react_native_pods'
target 'AntrimElimChurch' do
# Comment the next line if you don't want to use dynamic frameworks
#use_frameworks!
# Pods for Example
# pod 'React', :path => '../node_modules/react-native'
pod 'RNSound', :path => '../node_modules/react-native-sound'
pod 'RNCAsyncStorage', :path => '../node_modules/#react-native-community/async-storage'
pod 'RNCMaskedView', :path => '../node_modules/#react-native-community/masked-view'
pod 'RNCPushNotificationIOS', :path => '../node_modules/#react-native-community/push-notification-ios'
pod 'react-native-slider', :path => '../node_modules/#react-native-community/slider'
pod 'RNFBApp', :path => '../node_modules/#react-native-firebase/app'
pod 'RNFBAuth', :path => '../node_modules/#react-native-firebase/auth'
pod 'RNFBMessaging', :path => '../node_modules/#react-native-firebase/messaging'
pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'
pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'
pod 'react-native-safe-area-context', :path => '../node_modules/react-native-safe-area-context'
pod 'RNScreens', :path => '../node_modules/react-native-screens'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
target 'Example-tvOSTests' do
inherit! :search_paths
# Pods for testing
pod 'react-native-notifications', :path => '../node_modules/react-native-notifications'
end
target 'ExampleTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'Example-tvOS' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for Example-tvOS
end
After this change run again pod install and it should build

Getting [!] Invalid `Podfile` file: syntax error, unexpected ':', expecting end-of-input

Can someone please help? It seems to not be accepting my podfile even though I think I have the correct syntax. I'm getting [!] Invalid Podfile file: syntax error, unexpected ':', expecting end-of-input.
# Uncomment the next line to define a global platform for your project
platform :ios, '13.0'
use_frameworks!
target: 'Neat' do
# Comment the next line if you don't want to use dynamic frameworks
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral.podspec"
pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars.podspec"
pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts.podspec"
pod 'Permission-FaceID', :path => "#{permissions_path}/FaceID.podspec"
pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary.podspec"
pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
pod 'Permission-Motion', :path => "#{permissions_path}/Motion.podspec"
pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec"
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"
pod 'Permission-Reminders', :path => "#{permissions_path}/Reminders.podspec"
pod 'Permission-Siri', :path => "#{permissions_path}/Siri.podspec"
pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition.podspec"
pod 'Permission-StoreKit', :path => "#{permissions_path}/StoreKit.podspec"
pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
pod 'react-native-geolocation', :path => '../node_modules/#react-native-community/geolocation'
pod 'ReactNativeGetLocation', :path => '../node_modules/react-native-get-location'
pod 'amplify-tools'
pod 'Amplify'
pod 'AWSPluginsCore'
pod 'AmplifyPlugins/AWSAPIPlugin'
pod 'Firebase/Analytics'
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
end
target: 'NeatTests' do
inherit! :search_paths
# Pods for testing
end
target: 'NeatUITests' do
# Pods for testing
end
try removing : after the two targets at the end. it should be
target 'NeatTests' do
and
target 'NeatUITests' do
also,
target 'Neat' do

React/RCTDefines.h' file not found (RN0.61)

Performed RN upgrade from RN0.60 to RN0.61. Build failed with iOS, due to the following issue:
/react-native/React/Base/RCTBridgeModule.h:10:9: 'React/RCTDefines.h' file not found
I am aware of this breaking changes. (React.xcodeproj is deprecated)
Try a few things
npx react-native-clean-project & re-setup project
remove Pods/ & pod install
...running out of idea...
Here's how my podfile looks like.
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'ReactCommon/jscallinvoker', :path => '../node_modules/react-native/ReactCommon'
pod 'ReactCommon/turbomodule/core', :path => '../node_modules/react-native/ReactCommon'
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
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'
# Required by RNFirebase
pod 'Firebase/Core', '~> 6.9.0'
pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'
pod 'Fabric', '~> 1.10.2'
pod 'Crashlytics', '~> 3.14.0'
# FBSDK
pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'
pod 'react-native-netinfo', :path => '../node_modules/#react-native-community/netinfo'
pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker'
pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'
pod 'react-native-webview', :path => '../node_modules/react-native-webview'
Here's my solution after spending a full day in digging the reason why,
.
.
.
.
TLDR;
You need to add .podspec to podfile for whichever 3rd party/custom library that complain unable to find React/{whatever.h}
3rd party Libraries
If you are using a 3rd party library (Yarn/NPM/etc)
Copy podspec from other 3rd party library (eg, RNDeviceInfo/etc..)
Create own podspec by replacing a few item (s.name, s.source) I actually left others as default but you can modify as per your usage if you want
s.name = "NoSupportedLib"
s.source = { :git => "https://github.com/react-native-community/NoSupportedLibName.git", :tag => "v#{s.version}" }
You might want to take care the following, because not all your dependency may store under the folder path ios/**/your.m & your.h files
s.source_files = "ios/**/*.{h,m}"
Add new line to podfile
pod 'NoSupportedLib', :path => '../node_modules/NoSupportedLib'
Pod install
Local Dependencies
In the case where you have a local dependency, you should do the same as well (instead of adding the .a file into your Xcode's Linked Framework and Libraries.)
Follow the same steps as described on top
At step 2 where you declare the s.source & s.source_files, you shall do the following: (Assumption you are create this custom.podspec at the same custom library path, you would otherwise need to modify the s.source path as your need)
s.source = { :http => 'file:' + __dir__ + '/' }
s.source_files = "customLib/*.{h,m}"
Add new line to podfile
pod 'customLib', :path => '../localDependency/customLib'
Sub-points
I tried adding React under my scheme as build target, apparently it does not help. I think for project that is >=RN0.60, we are meant to use autolinking provided by ReactNative? Hence to keep our Xcode's Linked Framework and Libraries clean.
I've had the same issue a while ago. It was fixed after: product > scheme > edit scheme, go to the build tab and add react as the first target.
I had this same issue, I went into /node_modules/react-native/React/Base/RCTBridgeModule.h and changed #import <React/RCTDefines.h> into
#if __has_include("RCTDefines.h")
#import "RCTDefines.h"
#else
#import <React/RCTDefines.h>
#endif
ref below link
https://github.com/facebook/react-native/issues/26754#issuecomment-539550146
Go to Project navigator > Libraries > RNFetchBlob.xcodeproj
Click on Build Settings and then the first item under "Targets"
Scroll down to 'Search Paths' -> 'Header Search Paths'
Make sure to have enable filter 'All'
Add the following entry (click '+'): ${SRCROOT}/../../../ios/Pods/Headers
Make sure to set it to recursive.
Clean (cmd + shift + K) and re-build (cmd + B)
Solved here

'React/RCTEventEmitter.h' file not found (CocoaPods)

I'm going back to a React Native project and getting the following build error:
'React/RCTEventEmitter.h' file not found
The project uses CocoaPods to bring in React and its dependencies. The error seems to be to do with a missing header in one of my custom modules. The specific line with the import error is at https://github.com/adamski/react-native-couchbase/blob/8bc089a1e4cfdf62599b1f156072aa12a3823b30/ios/RCTCouchBase/RCTCouchBase/RCTCouchBase.h#L8
The error only started to appear after adding a new node module and running pod install.
I've have tried various things to fix it such as:
Upgrading RN (from 0.51 to 0.55 and back again)
Deleting and reinstalling node_modules
Adding various paths to Header Search Paths. e.g. ${PODS_ROOT}/Headers/Public/React
Deleting Build folder
If I change the import to #import "RCTEventEmitter" it then falls over on:
'React/RCTBridge.h' file not found from RCTEventEmitter.h.
Anything else that could be going wrong here?
I recently had to upgrade to Xcode 10 for another project, perhaps that is an issue?
Podfile:
react_native_path = '../../node_modules/react-native'
install! 'cocoapods', :deterministic_uuids => false
platform :ios, '8.0'
target 'MyApp - App' do
pod 'HockeySDK', '~> 4.1.3'
pod 'React', :path => '../../node_modules/react-native', :subspecs => [
'ART',
'Core',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTText',
'RCTWebSocket',
'RCTAnimation',
'DevSupport',
'BatchedBridge',
# Add any other subspecs you want to use in your project
]
# To use CocoaPods with React Native, you need to add this specific Yoga spec as well
pod 'yoga', :path => react_native_path + '/ReactCommon/yoga'
pod 'couchbase-lite-ios', '~> 1.4.0'
pod 'couchbase-lite-ios/ForestDB', '~> 1.4.0'
pod 'mp3lame-for-ios'
pod 'ReactNativeCouchbase', :path => '../../node_modules/react-native-couchbase'
pod 'ReactNativeNavigation', :path => '../../node_modules/react-native-navigation'
pod 'RNVectorIcons', :path => '../../node_modules/react-native-vector-icons'
pod 'RNSVG', :path => '../../node_modules/react-native-svg'
pod 'RNDeviceInfo', :path => '../../node_modules/react-native-device-info'
pod 'react-native-in-app-utils', :path => '../../node_modules/react-native-in-app-utils'
pod 'react-native-mail', :path => '../../node_modules/react-native-mail'
pod 'BVLinearGradient', :path => '../../node_modules/react-native-linear-gradient'
pod 'RNSound', :path => '../../node_modules/react-native-sound'
pod 'react-native-youtube', :path => '../../node_modules/react-native-youtube'
pod 'RNStoreReview', :path => '../../node_modules/react-native-store-review/ios'
end