React-native-fcm: react-native run-ios failing

Created on 29 Jun 2016  路  50Comments  路  Source: evollu/react-native-fcm

I have no clue as to what the issue is related to

screenshot

Edit: special thanks to @evollu for all the patience and help.
https://github.com/ahmed1490/igniteFCM example implementation for fcm can be found here.

This is https://github.com/infinitered/ignite 'ed example app

Most helpful comment

I think that I have figured this one out.

All 50 comments

I do have the libs linked and changes configured acc to readme

/Libraries

screenshot

in Build phases

screenshot

Appdelegate.m

screenshot

Podfile

screenshot

Podfile.lock

screenshot

The filename of plist downloaded from console is different from what is mentioned in readme however: its called ios/GoogleService-Info.plist

Any luck with this? facing the same..

+1. Subscribe

I think that I have figured this one out.

@gorangajic I quickly tried it with a fresh project and got these:

'Undefined symbols for architecture x86_64:
"std::__1::basic_string, std::__1::allocator >::__init(char const_, unsigned long)", referenced from:
___23-[RCTJSCExecutor setUp]_block_invoke.146 in libReact.a(RCTJSCExecutor.o)
"std::__1::basic_string, std::__1::allocator >::~basic_string()", referenced from:
___23-[RCTJSCExecutor setUp]_block_invoke.146 in libReact.a(RCTJSCExecutor.o)
"std::terminate()", referenced from:
___clang_call_terminate in libReact.a(RCTJSCExecutor.o)
"operator delete", referenced from:
-[RCTJSCExecutor dealloc] in libReact.a(RCTJSCExecutor.o)
executeRandomAccessModule(RCTJSCExecutor_, unsigned int, unsigned long, unsigned long) in libReact.a(RCTJSCExecutor.o)
readRAMBundle(std::__1::unique_ptr<__sFILE, int (_)(__sFILE_)>, RandomAccessBundleData&) in libReact.a(RCTJSCExecutor.o)
RandomAccessBundleData::~RandomAccessBundleData() in libReact.a(RCTJSCExecutor.o)
"operator new", referenced from:
executeRandomAccessModule(RCTJSCExecutor_, unsigned int, unsigned long, unsigned long) in libReact.a(RCTJSCExecutor.o)
readRAMBundle(std::__1::unique_ptr<__sFILE, int (_)(__sFILE_)>, RandomAccessBundleData&) in libReact.a(RCTJSCExecutor.o)
"___cxa_begin_catch", referenced from:
___clang_call_terminate in libReact.a(RCTJSCExecutor.o)
"___gxx_personality_v0", referenced from:
-[RCTJavaScriptContext initWithJSContext:onThread:] in libReact.a(RCTJSCExecutor.o)
-[RCTJavaScriptContext init] in libReact.a(RCTJSCExecutor.o)
-[RCTJavaScriptContext invalidate] in libReact.a(RCTJSCExecutor.o)
RCTNSErrorFromJSError(RCTJSCWrapper_, OpaqueJSContext const_, OpaqueJSValue const_) in libReact.a(RCTJSCExecutor.o)
+[RCTJSCExecutor runRunLoopThread] in libReact.a(RCTJSCExecutor.o)
-[RCTJSCExecutor init] in libReact.a(RCTJSCExecutor.o)
-[RCTJSCExecutor context] in libReact.a(RCTJSCExecutor.o)
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)'

@derdav3 looks like the error is related to react itself?

@derdav3 @ahmed1490 looks like you are running with react-native cli? If so, try open .xcworkspace not .xcproject and run in xcode

I am gonna try this @evollu and let you know

@evollu Just opened the .xcworkspace and tried to build the app, getting 8 errors:

Apple Mach-O Linker Error Group
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:

  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:

  "std::terminate()", referenced from:

  "operator delete[](void*)", referenced from:

  "operator new[](unsigned long)", referenced from:

  "___cxa_begin_catch", referenced from:

  "___gxx_personality_v0", referenced from:

clang: error: linker command failed with exit code 1 (use -v to see invocation)

and the whole log:

Undefined symbols for architecture x86_64:
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:
      ___23-[RCTJSCExecutor setUp]_block_invoke.146 in libReact.a(RCTJSCExecutor.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
      ___23-[RCTJSCExecutor setUp]_block_invoke.146 in libReact.a(RCTJSCExecutor.o)
  "std::terminate()", referenced from:
      ___clang_call_terminate in libReact.a(RCTJSCExecutor.o)
  "operator delete[](void*)", referenced from:
      -[RCTJSCExecutor dealloc] in libReact.a(RCTJSCExecutor.o)
      executeRandomAccessModule(RCTJSCExecutor*, unsigned int, unsigned long, unsigned long) in libReact.a(RCTJSCExecutor.o)
      readRAMBundle(std::__1::unique_ptr<__sFILE, int (*)(__sFILE*)>, RandomAccessBundleData&) in libReact.a(RCTJSCExecutor.o)
      RandomAccessBundleData::~RandomAccessBundleData() in libReact.a(RCTJSCExecutor.o)
  "operator new[](unsigned long)", referenced from:
      executeRandomAccessModule(RCTJSCExecutor*, unsigned int, unsigned long, unsigned long) in libReact.a(RCTJSCExecutor.o)
      readRAMBundle(std::__1::unique_ptr<__sFILE, int (*)(__sFILE*)>, RandomAccessBundleData&) in libReact.a(RCTJSCExecutor.o)
  "___cxa_begin_catch", referenced from:
      ___clang_call_terminate in libReact.a(RCTJSCExecutor.o)
  "___gxx_personality_v0", referenced from:
      -[RCTJavaScriptContext initWithJSContext:onThread:] in libReact.a(RCTJSCExecutor.o)
      -[RCTJavaScriptContext init] in libReact.a(RCTJSCExecutor.o)
      -[RCTJavaScriptContext invalidate] in libReact.a(RCTJSCExecutor.o)
      RCTNSErrorFromJSError(RCTJSCWrapper*, OpaqueJSContext const*, OpaqueJSValue const*) in libReact.a(RCTJSCExecutor.o)
      +[RCTJSCExecutor runRunLoopThread] in libReact.a(RCTJSCExecutor.o)
      -[RCTJSCExecutor init] in libReact.a(RCTJSCExecutor.o)
      -[RCTJSCExecutor context] in libReact.a(RCTJSCExecutor.o)
      ...
ld: symbol(s) not found for architecture x86_64

@dnish is the build target your react native project?
can you find out what module is throwing this error?

@dnish Don't know if you got the edited post, the only file I can see is libReact.a. I'm using React Native 0.28. Build target is my RN app.

Well I don't get much information here. I assume you are seeing a project structure similar to mine.
screen shot 2016-07-06 at 2 11 51 pm
Try pick target RNFIRMessaging and cmd+B to build the library to see if the library build correctly.

Perhaps I haven't run react-native upgrade for a long long time. let me upgrade and see
Since 0.26.0-rc, you must add -lc++ to the Other flags in the xcode project.
UPDATE: it is still working for me

I'll reset my project and try every step again, maybe I did a mistake.

@evollu The error happens directly after pod install, even without adding react-native-fcm. This is what I get if I execute install:

[!] The `xxapp [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods-xxeapp/Pods-xxapp.debug.xcconfig'. This can lead to problems with the CocoaPods installation

I already added inherited to my building settings, but my build still fails. My final build errors are:

diff: /../Podfile.lock: No such file or directory

diff: /Manifest.lock: No such file or directory

error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

Just tried everything, clean the project and check the Pod path, everything is set fine.

Are you adding $(inherited) in Linking->Other Linker flags?

Yep, I've added it but it is still failing.

error: The sandbox is not in sync with the Podfile.lock.
can you update cocoapod to lastest and run pod install again? I remember the pod requires cocoapod>1 or something like that.

I've just installed it for the plugin yesterday, it is on version 1.0.1

It looks like a cocoaPods issue. All I can do is google for you...
try this? http://stackoverflow.com/questions/21366549/errorthe-sandbox-is-not-in-sync-with-the-podfile-lock-after-installing-res

@evollu Yeah thanks, that's all not working. I've reverted my project via git and the error occurs directly after doing pod install, even without any plugin added in the podfile. I'll figure this out the next days. So it has nothing to do with the fcm plugin.

@dnish pls keep me updated if you found the solution... I'm sitting in the same boat

@dnish thanks for all the information.
BTW I'm running pod 1.0.0

hey guys, if you want to try without cocoapods, the nopod branch should work. Follow https://firebase.google.com/docs/ios/setup last section to integrate frameworks
note: the official zip file is missing FirebaseAnalytics.framework, I pulled it from pods version and up it in the repo

new version has been pushed to npm. If you can't get pod to work, just import framework files

I will try this tonight

let's figure this on gitter. should be configuration issue

@ahmed1490 @derdav3 are you able to give it another try?

The repo read me is a bit unclear to me: FirebaseAnalytics.framework I already imported it from firebase site. Do I need to override with the project's version?

Facing this.. while trying non-cocoapods approach

screenshot

"react-native": "^0.28.0",

I added the libs:
screenshot

and my app root.js

screenshot

and Appdelegate.m

screenshot

and did npm i --save react-native-fcm & react-native link

I also have the config file from console:
screenshot

oh they added the missing framework file. I will update readme.

the error log seems to be cut off

@evollu thats the last line of error log. Next line is just by usual bash prompt
edit: I restarted the server today. it worked
edit: I was running the wrong app. Still not working. Screenshot

screenshot

source code.
https://github.com/ahmed1490/igniteFCM/commit/5ba627eb505fffaeab0ab253861121af2caa6936

not sure if it helps..I commented all the fcm code in js.

/Users/aabbas/wo/native/igniteFCM/node_modules/react-native-fcm/ios/RNFIRMessaging.h:4:9: fatal error:
      'Firebase.h' file not found
#import "Firebase.h"

screenshot

...

and is this related?
https://github.com/evollu/react-native-firebase-analytics/issues/5

I will pull your code and take a look

@ahmed1490 you need to add Firebase.h into your project
it is in the README of FCM zip

oh yes! @evollu
I added the firebase.h now. The build succeeds but the app refuses to start. It opens and closes from splash screen. weird behaviour. Any hints?

ignitefcm

even if i click the app it closes..

ignitefcm_mobile

check your nslog
i got '[FIRApp configure] could not find a valid GoogleServices-Info.plist in your project.

I appreciate you help so much!
how and where can I check this nslog? Also I added this now (i did add earlier. not sure where it disappeared). Still the result is same.

edit: for those reading. You must add the .plist file through the xcode! Dont copy it to ios/ folder

I feel this react-native run-ios works too fast for me. I dont know if its skipping something

open the project file in xcode, there is a log panel in the bottom.
there is nothing wrong with run-ios, just it abstract away to many things for you

@evollu Thank you for walkine me through.

Is this the log panel you talking about?

screenshot

And.. Yaaay I got the notification finally But one small issue..

i am not sure what is that "e".. but the body of the message is not delivered. Is it this way on ios?

screenshot

what i got..
screenshot

documentation says.. (// there are two parts of notif. notif.notification contains the notification payload, notif.data contains data payload)

but there is no notif.data

readme says.. the notification should look like

  "notification": {
      "title": "hello",
      "body": "yo",
      "click_action": "fcm.ACTION.HELLO"
  },

edited comment ^

That was a message label I was assuming as message body!

My mistake.. everything is good :D Thank you veery much!! appreciate it :)

cool

Gonna try andriod tommorrow :)

fwiw, I ran into the same problem as @derdav3, and after googling and some trial and error, this worked for me:
1) open .xcworkspace
2) In xcode, under "Build Settings", make sure the target is Tests (not the app itself), search for "Other Linker Flags" and add "-lc++" to the Other Linker Flags settings
otherviews_and_googrn_xcodeproj_and_hipchat

In case someone else faces this issue, adding the GoogleServices-Info.plist file through the project navigator helped

Same problem with "can't found a valid GoogleService-Info.plist" :(

Seems like just copying the GoogleService-Info.plist to the project folder is not enough. Instead you need to open the project in xcode, open the file-tree in the left, and then drag'n'drop the GoogleService-Info.plist to the project folder from finder 馃樁 Once you that xcode will popup a window, make sure you tick the 'Copy if necessary' option.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xavieramoros picture xavieramoros  路  4Comments

gplopes picture gplopes  路  6Comments

KBepo picture KBepo  路  4Comments

holyxiaoxin picture holyxiaoxin  路  4Comments

jitenderchand1 picture jitenderchand1  路  4Comments