React-native-fbsdk: TypeError: Cannot read property 'logEvent' of undefined

Created on 22 Mar 2019  Â·  10Comments  Â·  Source: facebook/react-native-fbsdk

Testing on iOS.

import { AppEventsLogger } from 'react-native-fbsdk';

AppEventsLogger.logEvent('battledAnOrc');

gives

TypeError: Cannot read property 'logEvent' of undefined

I believe react-native-link worked correctly because

- (void)applicationDidBecomeActive:(UIApplication *)application {
    [FBSDKAppEvents activateApp];
}

works.

Any suggestions?

All 10 comments

any updates?

same issue.
log events from objective-c works but not from react-native.

add RCTFBSDK to you ios project libraries folder, select your project from target go to build phase go Link binary with libraries and add libRCTFBSDK.a, and you are good to go :)

Now I get 'React/RCTBridgeModule.h' file not found ( from
RCTFBSDKAppEvents.h )

On Wed, Apr 10, 2019 at 3:16 PM SAJID ALI notifications@github.com wrote:

add RCTFBSDK to you ios project libraries folder, select your project
from target go to build phase go Link binary with libraries and add
libRCTFBSDK.a, and you are good to go :)

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/facebook/react-native-fbsdk/issues/498#issuecomment-481666093,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADO2tEpZQ3GOu69AX4OkbJxUTpOobLT5ks5vfdYrgaJpZM4cC11L
.

Facing the same bug here

Now I get 'React/RCTBridgeModule.h' file not found ( from RCTFBSDKAppEvents.h )
…
On Wed, Apr 10, 2019 at 3:16 PM SAJID ALI @.*> wrote: add RCTFBSDK to you ios project libraries folder, select your project from target go to build phase go Link binary with libraries and add libRCTFBSDK.a, and you are good to go :) — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#498 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/ADO2tEpZQ3GOu69AX4OkbJxUTpOobLT5ks5vfdYrgaJpZM4cC11L .

yeah exactely :)

I fixed this issue! There is a missing step, which has been added to the Readme (#418) but not merged, and it's very simple:

Just drag RCTFBSDK.xcodeproj from node_modules/react-native-fbsdk/ios into Libraries in Xcode, and then you can link libRCTFBSDK.a in "Link binary with libraries"! The other *.a files must also be linked, but that was happening with my build automatically, where as the libRCTFBSDK.a was the missing link!

@kyleschmolze Your answer solved my issue, thanks man.

+1

In my case, react-native link react-native-fbsdk worked. Also run react-native run-android after linking.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chirag04 picture chirag04  Â·  4Comments

peymancyb picture peymancyb  Â·  6Comments

akash-rajput picture akash-rajput  Â·  4Comments

smzeeshan91 picture smzeeshan91  Â·  4Comments

yanguyt picture yanguyt  Â·  4Comments