React-native-firebase: Problem with settings up Cloud Messaging

Created on 9 Nov 2017  路  17Comments  路  Source: invertase/react-native-firebase

Issue

When I follow the guide for installing Cloud Messaging on iOS I get the following errors.

I add the 5 methods as mentioned here. But the line

withCompletionHandler:(void (^)())completionHandler {

gives the error

Conflicting parameter types in implementation of
'userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:'
: 'void (^ _Nonnull __strong)(void)' vs 'void (^__strong _Nonnull)()'

image

Additionally compiling fails with the error:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_RNFirebaseMessaging", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Environment

  1. Application Target Platform: iOS
  2. Development Operating System: macOS Sierra
  3. Build Tools: Xcode 9.1
  4. React Native version: 3.1.0
  5. RNFirebase Version:
  6. Firebase Module: Messaging
Waiting for User Response

Most helpful comment

I did the following

  1. react-native unlink react-native-firebase
  2. rm node_modules/react-native-firebase/RNFirebase.podspec
  3. react-native link react-native-firebase
  4. Cleared derived data (just in case)

Now the app compiles without errors 馃槃 I have not tested notifications yet. But the fact that it compiles probably means that it works.

That is really nice. Deleting the podspec isn't too bad a workaround for now.

I'm sorry that React Native is causing you problems. It sounds frustrating 馃樋 As users, we've had our share of problems as well. But, do know that the work you do on react-native-firebase is much appreciated 馃憤

All 17 comments

screen shot 2017-11-13 at 11 03 10 am

Hope it could help you.

@paldepind have you resolved the issue based on @sseyha followed by a derrived data clearing on xcode?

Thank you for answering @Salakar. No, unfortunately not. I am still unable to get react-native-firebase to work on iOS.

Inserting the void as suggested by @sseyha does remove the error from the line that I pasted from the docs (maybe it should also be added to the docs?). But, unfortunately, I still get the same compile time error as I posted above.

@paldepind are you using pods on your project or are you going via header search paths? If it's pods could we see your podfile as well if possible please, thanks

I've also updated the docs as per the above. Thanks @sseyha

@Salakar

I'm using pods. Here is my Podfile

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'myappname' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for qreport

  pod 'Firebase/Core'
  pod 'Firebase/Messaging'

  target 'myappname-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'myappnameTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

The tvOSTests and Tests targets are currently unused though.

When I look at the directory ios/Pods both Firebase and FirebaseMessaging appears so it looks like they're installed correctly.

Please let me know if there is anything more you need to know 馃槃

@paldepind Have you run react-native link react-native-firebase?

Note, because of some changes in React Native, you need to be a version of React Native less than 0.50 for the above to work

@chrisbianca

Thank you for helping. Yes, I've run react-native link react-native-firebase. When I ran it again just now it told me that it was already linked.

> react-native link react-native-firebase
rnpm-install info Android module react-native-firebase is already linked
rnpm-install info iOS module react-native-firebase is already linked

I am using React Native version 50.3 in case that is relevant.

I should also mention that React Native Firebase was working fine _before_ I added the Cloud Messaging module. The problem seems to be related to the messaging module only.

I just tried the instructions mentioned in another issue here. I cleared DerivedData, removed all the installed pods, updated CocoaPods, reinstalled all the pods and cleared ios/build. But the error message is the same 馃槶

@paldepind just noticed that you said you're using version 0.50.3 - there is a known issue caused by some breaking changes in RN which they have been unwilling to engage in conversation about. I'd suggest following: https://github.com/invertase/react-native-firebase/issues/636

@chrisbianca Thank you for the response. Is there any solution besides downgrading React Native?

Unfortunately, we're still trying to come up with the best way forward.

If we remove the .podspec file, it would fix the issue for new users, but would break backwards compatibility for people that have been using the .podspec file to link their library in the past.

In the short term, if you unlink the library react-native unlink react-native-firebase, then delete the .podspec file in node_modules/react-native-firebase and then run react-native link react-native-firebase it might work?

I did the following

  1. react-native unlink react-native-firebase
  2. rm node_modules/react-native-firebase/RNFirebase.podspec
  3. react-native link react-native-firebase
  4. Cleared derived data (just in case)

Now the app compiles without errors 馃槃 I have not tested notifications yet. But the fact that it compiles probably means that it works.

That is really nice. Deleting the podspec isn't too bad a workaround for now.

I'm sorry that React Native is causing you problems. It sounds frustrating 馃樋 As users, we've had our share of problems as well. But, do know that the work you do on react-native-firebase is much appreciated 馃憤

Glad you're up and running!
Yes, we've had plenty of problems caused by RN over the past year, but we'll figure something out!

@chrisbianca and @paldepind i was having same issue with react-native-firebase, thanks for this fix i am glad to see project build successfully after upgrading and downgrading versions.

@paldepind how you clear the derived data?? please mention ..

@nzrsrk It can be done through Xcode. Check out this SO answer for instance: https://stackoverflow.com/questions/46468220/how-can-i-delete-derived-data-in-xcode-9/46468462

Was this page helpful?
0 / 5 - 0 ratings