facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 910 forks source link

null is not an object (evaluating AppEventsLogger.logEvent) #717

Open pvanny1124 opened 4 years ago

pvanny1124 commented 4 years ago

šŸ› Bug Report

Screen Shot 2020-03-02 at 11 56 46 PM

To Reproduce

  1. follow basic iOS installation for facebook sdk found on https://developers.facebook.com/quickstarts
  2. installed react-native-fbsdk@0.10
  3. manually linked libRCTFBSDK.a

currently running react-native 0.59.1

Expected Behavior

log an event using AppEventsLogger.logEvent('some_event')

Code Example

https://snack.expo.io/HJPn4wjNU -- sample code is in App.js

Environment

React Native Environment Info: System: OS: macOS 10.15.1 CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz Memory: 55.39 MB / 32.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.13.0 - /usr/local/bin/node npm: 6.4.1 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1 Android SDK: API Levels: 23, 25, 26, 27, 28 Build Tools: 26.0.1, 27.0.3, 28.0.3 System Images: android-22 | Google APIs Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64, android-25 | Intel x86 Atom_64, android-25 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-27 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom IDEs: Android Studio: 3.5 AI-191.8026.42.35.5977832 Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild npmPackages: react: 16.8.3 => 16.8.3 react-native: 0.59.1 => 0.59.1 npmGlobalPackages: create-react-native-app: 2.0.2 react-native-cli: 2.0.1

I have already setup the app on the developers page. So confused as to why this simple method isn't working. tried everything that i've come across online!

gmertk commented 4 years ago

I'd suggest you to use the latest version, and it will work fine.

  "dependencies": {
    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-fbsdk": "^1.1.2"
  },

Install with:

yarn add react-native-fbsdk
cd ios/ && pod install
pvanny1124 commented 4 years ago

hey @gmertk. I managed to fix the problem by downgrading the react-native-fbsdk version to 0.8.0. and the app is running fine now. However, I can't see any of the events on the events manager whenever the logEvent function runs (I assume it's running fine since I'm not getting any errors at all). Everything else is kept the same.

I decided to leave our react-native version the way it is just because it would take too long to make the jump to 0.60+ as there are a lot of breaking changes (from what I've heard).

Any suggestions? Thanks!

gabrielCodeSolutions commented 4 years ago

i'm having the same problem as @pvanny1124 , please someone help! rsrs. I can't update to 0.60 either. Any suggestions? Thanks!

AndersonSchmidt commented 4 years ago

I have the same problem.

AndersonSchmidt commented 4 years ago

i'm having the same problem as @pvanny1124 , please someone help! rsrs. I can't update to 0.60 either. Any suggestions? Thanks!

Did you solve it?

shehzadosama commented 4 years ago

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

creativemind1 commented 4 years ago

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

You saying AppEvents working for you? Do you able to log events?

shehzadosama commented 4 years ago

@creativemind1 yes able to log events

creativemind1 commented 4 years ago

in iOS?

shehzadosama commented 4 years ago

@creativemind1 no, in Android