react-native-fcm: FirebaseCore/FIRApp.h' file not found

Upgrading to version 10.0.0 (from a quite an older version), iOS build failed with the following error:

xxxxxx/node_modules/react-native-fcm/ios/RNFIRMessaging.m:1:
xxxxxx/node_modules/react-native-fcm/ios/RNFIRMessaging.h:4:9: fatal error: 'FirebaseCore/FIRApp.h' file not found
#import <FirebaseCore/FIRApp.h>
        ^
1 error generated.

This affects debug builds only.

I believe the that the cause is framework/header search paths in RNFIRMessaging.xcodeproj/project.pbxproj:

				FRAMEWORK_SEARCH_PATHS = (
					"$(inherited)",
					"$(PROJECT_DIR)/../../../ios/Pods/**",
					"$(SRCROOT)/../../../node_modules/react-native-firestack/ios/**",
				);
				GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
				HEADER_SEARCH_PATHS = (
					"$(SRCROOT)/../../react-native/React/**",
					"$(PROJECT_DIR)/../../../ios/Pods/**",
					"$(SRCROOT)/../../../node_modules/react-native-firestack/ios/**",

while in Release scheme it is set to this:

				FRAMEWORK_SEARCH_PATHS = (
					"$(inherited)",
					"$(PROJECT_DIR)/../../../ios/**",
					"$(SRCROOT)/../../../node_modules/react-native-firestack/ios/**",
				);
				HEADER_SEARCH_PATHS = (
					"$(SRCROOT)/../../react-native/React/**",
					"$(SRCROOT)/../../../ios/**",
					"$(SRCROOT)/../../../node_modules/react-native-firestack/ios/**",
				);

This configuration assumes usage of Cocoapods.

Changing "$(PROJECT_DIR)/../../../ios/Pods/**" to the more universal "$(PROJECT_DIR)/../../../ios/**" as in the Release scheme fixes this issue

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 8
  • Comments: 22 (7 by maintainers)

Most upvoted comments

@sibelius Move all your Firebase SDK into /ios/Pods folder. it is not working for you?

At the end I just used apns for the project push notification

when I try to call

RCT_EXPORT_METHOD(getFCMToken:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
{
    resolve([FIRMessaging messaging].FCMToken);
}

then I have a crash

2017-12-06 16:27:00.392752+0600 app[69029:9322973] +[FIRInstanceIDCheckinPreferences preferencesFromKeychainContents:]: unrecognized selector sent to class 0x1144840d8
2017-12-06 16:27:00.406770+0600 app[69029:9322973] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[FIRInstanceIDCheckinPreferences preferencesFromKeychainContents:]: unrecognized selector sent to class 0x1144840d8'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000011627c1cb __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x0000000115790f41 objc_exception_throw + 48
	2   CoreFoundation                      0x00000001162fc854 +[NSObject(NSObject) doesNotRecognizeSelector:] + 132
	3   CoreFoundation                      0x00000001161ff178 ___forwarding___ + 1432
	4   CoreFoundation                      0x00000001161feb58 _CF_forwarding_prep_0 + 120
	5   react_native_fcm                    0x0000000114425bd9 -[FIRInstanceIDCheckinStore cachedCheckinPreferences] + 407
	6   react_native_fcm                    0x000000011442a399 -[FIRInstanceIDStore cachedCheckinPreferences] + 48
	7   react_native_fcm                    0x0000000114421c13 -[FIRInstanceIDAuthService initWithCheckinService:store:] + 134
	8   react_native_fcm                    0x0000000114421d3e -[FIRInstanceIDAuthService initWithStore:] + 94
	9   react_native_fcm                    0x000000011442ce2a -[FIRInstanceIDTokenManager init] + 160
	10  react_native_fcm                    0x000000011441e487 -[FIRInstanceID setupTokenManager] + 50
	11  react_native_fcm                    0x000000011441e435 -[FIRInstanceID start] + 90
	12  libdispatch.dylib                   0x000000011684a43c _dispatch_client_callout + 8
	13  libdispatch.dylib                   0x000000011684b9c7 dispatch_once_f + 297
	14  react_native_fcm                    0x000000011441bae0 +[FIRInstanceID instanceID] + 45
	15  react_native_fcm                    0x0000000114442a5c __46+[FIRMessagingInstanceIDProxy instanceIDProxy]_block_invoke + 84
	16  libdispatch.dylib                   0x000000011684a43c _dispatch_client_callout + 8
	17  libdispatch.dylib                   0x000000011684b9c7 dispatch_once_f + 297
	18  react_native_fcm                    0x0000000114442a05 +[FIRMessagingInstanceIDProxy instanceIDProxy] + 45
	19  react_native_fcm                    0x0000000114442c05 -[FIRMessagingInstanceIDProxy token] + 40
	20  react_native_fcm                    0x0000000114434d06 -[FIRMessaging FCMToken] + 87
	21  react_native_fcm                    0x0000000114418639 -[RNFIRMessaging getFCMToken:rejecter:] + 137
	22  CoreFoundation                      0x000000011620056c __invoking___ + 140
	23  CoreFoundation                      0x0000000116200440 -[NSInvocation invoke] + 320
	24  CoreFoundation                      0x0000000116218df6 -[NSInvocation invokeWithTarget:] + 54
	25  React                               0x0000000110b9563c -[RCTModuleMethod invokeWithBridge:module:arguments:] + 2796
	26  React                               0x0000000110ba1d02 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 786
	27  React                               0x0000000110ba182f _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 127
	28  React                               0x0000000110ba17a9 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 25
	29  libdispatch.dylib                   0x00000001168493f7 _dispatch_call_block_and_release + 12
	30  libdispatch.dylib                   0x000000011684a43c _dispatch_client_callout + 8
	31  libdispatch.dylib                   0x000000011685295b _dispatch_queue_serial_drain + 1162
	32  libdispatch.dylib                   0x00000001168532df _dispatch_queue_invoke + 336
	33  libdispatch.dylib                   0x000000011684f07d _dispatch_queue_override_invoke + 733
	34  libdispatch.dylib                   0x00000001168561f9 _dispatch_root_queue_drain + 772
	35  libdispatch.dylib                   0x0000000116855e97 _dispatch_worker_thread3 + 132
	36  libsystem_pthread.dylib             0x0000000116d101ca _pthread_wqthread + 1387
	37  libsystem_pthread.dylib             0x0000000116d0fc4d start_wqthread + 13

who can say what it may be?

@sibelius: How did you manage to resolve the crash? What links did you add in Xcode? Getting the same crash

I resolved this by adding the following to Build Settings => Framework Search Paths in the RNFIRMessaging project:

$(PROJECT_DIR)/…/…/…/ios/Pods/FirebaseCore $(PROJECT_DIR)/…/…/…/ios/Pods/FirebaseMessaging $(PROJECT_DIR)/…/…/…/ios/Pods/FirebaseAnalytics $(PROJECT_DIR)/…/…/…/ios/Pods/FirebaseInstanceID

Note that it’s not Header Search Paths since those are for local includes and this is a global include.