react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

Problem with settings up Cloud Messaging

Open paldepind opened this issue 9 years ago • 17 comments

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

paldepind avatar Nov 09 '17 13:11 paldepind

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

Hope it could help you.

sseyha avatar Nov 13 '17 04:11 sseyha

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

Salakar avatar Nov 21 '17 07:11 Salakar

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 avatar Nov 21 '17 18:11 paldepind

@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 avatar Nov 21 '17 19:11 Salakar

@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 avatar Nov 22 '17 18:11 paldepind

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

chrisbianca avatar Nov 22 '17 18:11 chrisbianca

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 avatar Nov 22 '17 18:11 chrisbianca

@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.

paldepind avatar Nov 22 '17 20:11 paldepind

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 avatar Nov 23 '17 13:11 paldepind

@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 avatar Dec 07 '17 11:12 chrisbianca

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

paldepind avatar Dec 07 '17 11:12 paldepind

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?

chrisbianca avatar Dec 07 '17 11:12 chrisbianca

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 👍

paldepind avatar Dec 07 '17 12:12 paldepind

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 avatar Dec 07 '17 12:12 chrisbianca

@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.

Zohaibmalikdev avatar Jul 24 '18 02:07 Zohaibmalikdev

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

nzrsrk avatar May 15 '19 14:05 nzrsrk

@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

paldepind avatar May 18 '19 19:05 paldepind