React-native-fcm: FCM invalid event

Created on 25 Nov 2016  Â·  14Comments  Â·  Source: evollu/react-native-fcm

I just updated everything to the last versions and after I do the ios bundle and try to run the app I get this message:
imag2523

If I dismiss it the app runs as expected.

My dependecies:
"react": "^15.4.1",
"react-native": "^0.38",
"react-native-fcm": "2.3.2"

I am testing on a iPhone 5 with iOS 10.0.2

Most helpful comment

"react": "15.4.2",
"react-native": "0.40.0",
"react-native-fcm": "^6.0.2",

I am getting Invalid FCM event subcription, use import {FCMEvent} from 'react-native-fcm' to avoid typo inside red screen.

Device: iphone 7 plus simulator.

Anyone have any suggestion.

All 14 comments

if nothing else helps try with react: 15.3.1 and react-native 0.36. I have not been able to run my app with the latest react(native) versions, because of other errors

looks like you are subscribing wrong event
it should be refreshToken or notification

@CristinaNicolae this are the valid events: https://github.com/evollu/react-native-fcm/blob/master/index.js#L3

@evollu maybe we should add an invariant to ensure the events are correct, and provide a better error message

https://github.com/exponentjs/ex-navigation/commit/8795fbe6f9d54bb7b59c43076bfefea544cce88f#diff-0b652261cfb3f4459e0cb33be663e872R47

will update error message

fixed

"react": "15.4.2",
"react-native": "0.40.0",
"react-native-fcm": "^6.0.2",

I am getting Invalid FCM event subcription, use import {FCMEvent} from 'react-native-fcm' to avoid typo inside red screen.

Device: iphone 7 plus simulator.

Anyone have any suggestion.

Check readme, there is a breaking change in v6. Are you using 'notication' for event subscription?

this.notificationListener = FCM.on('notification', (notif) => {
            // there are two parts of notif. notif.notification contains the notification payload, notif.data contains data payload
            if(notif.local_notification){
              //this is a local notification
            }
            if(notif.opened_from_tray){
              //app is open/resumed because user clicked banner
            }
            console.log(notif)
            // fcm token may not be available on first load, catch it here
        });

I am using this one and when commenting error gone. @evollu

Right use FCM.on(FCMEvent.Notification, callback)

Yes this is now working. Now I am getting in some other issue with xcode I can't run build it showing this above issue:
screen shot 2017-02-02 at 11 11 40 am

But when I do react-native run-ios it's building my app on simulator. Can you suggest reason behind this. I have also facing this problem and getting solution but when installing few plugins it's showing again on new react native package see this issue posted yesterday: https://github.com/facebook/react-native/issues/12042

It's not only issue with specific library it's showing file not found in many library files:

import

rctbridgemodule etc etc...

It was showing same on yesterday but I solved it with reinstalling everything with react native new package. But again now same issue.

Now I am not getting error on file not found but only rest this issue...
ld: warning: directory not found for option '-F/Users/appdeveloper/Library/Developer/Xcode/DerivedData/ProjectName-creunpzxffivaagyrmpgpqdcxwik/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac' ld: framework not found GoogleToolboxForMac clang: error: linker command failed with exit code 1 (use -v to see invocation)

ld: warning: directory not found for option '-F/Users/appdeveloper/Library/Developer/Xcode/DerivedData/ProjectName-creunpzxffivaagyrmpgpqdcxwik/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac'

Showing error
framework not found GoogleToolboxForMac

It just wasted my three working day :( but finally got solution.
I solved this issue with this provided solution:

1- opened workspace file before opening close everything.

2- added pod file in manage scheme suggested by :https://stackoverflow.com/questions/40358719/framework-not-found-googletoolboxformac

3- also i followed this suggestions too: http://stackoverflow.com/questions/9458739/ld-warning-directory-not-found-for-option

4-I also updated pod update.

5- Clean and build it's working now.
Now fcm is also working and not giving any error.
Note: just showing few warnings, I do not know how to solve those.

The second step and the third step can again a little bit in detail ? Now I only know to update pod,but it's field. pod profile use this ?

pod 'React', :path => '../node_modules/react-native', :subspecs => [
'RCTText',
'RCTImage',
'RCTNetwork',
'RCTWebSocket',
]

Hope you answer agin : )

Open 'Build Settings', search 'Header Search Path'.

Double click next to 'Header Search Path', where other properties have a 'yes' or 'no'

Now add following to the "Header Search Path" (under Build Settings):

$(SRCROOT)/../node_modules/react-native/React

Make it recursive.

Was this page helpful?
0 / 5 - 0 ratings