F8app: AppEventsLogger.logEvent

Created on 2 Aug 2016  路  29Comments  路  Source: fbsamples/f8app

_Error after booting the App and clicking the "X" to enter the home screen:_

undefined is not an object (evaluating 'AppEventsLogger.logEvent')

logEvent
FBAppEventsLogger.js:64
track
track.js:45

analytics.js:30

array.js:28

promise.js:33

index.js:14
onPress
LoginScreen.js:101
touchableHandlePress
TouchableOpacity.js:112
_performSideEffectsForTransition
Touchable.js:675
_receiveSignal
Touchable.js:593
touchableHandleResponderRelease
Touchable.js:396
invokeGuardedCallback
ReactErrorUtils.js:26
executeDispatch
EventPluginUtils.js:87
executeDispatchesInOrder
EventPluginUtils.js:110
executeDispatchesAndRelease
EventPluginHub.js:42
executeDispatchesAndReleaseTopLevel
EventPluginHub.js:53
forEachAccumulated
forEachAccumulated.js:24
processEventQueue
EventPluginHub.js:215
runEventQueueInBatch
ReactEventEmitterMixin.js:18
handleTopLevel
ReactEventEmitterMixin.js:29

ReactNativeEventEmitter.js:133
perform
Transaction.js:136
batchedUpdates
ReactDefaultBatchingStrategy.js:63
batchedUpdates
ReactUpdates.js:98
_receiveRootNodeIDEvent
ReactNativeEventEmitter.js:132
receiveTouches
ReactNativeEventEmitter.js:194
__callFunction
MessageQueue.js:193

MessageQueue.js:96
guard
MessageQueue.js:43
callFunctionReturnFlushedQueue
MessageQueue.js:95

_If I click on the Log in With Facebook button I get the following alert:_
undefined is not an object (evaluating 'LoginManager.logInWithReadPermissions')

Fresh project files, just downloaded the repo.

Regards,
Riccardo

Most helpful comment

Ran into the same issue. I was able to get around the issue by the following.

42:    case 'SKIPPED_LOGIN':
43:      //AppEventsLogger.logEvent('Skip login', 1);
44:      break;

All 29 comments

_Chrome console errors:_

Warning: Native component for "RCTFBLikeView" does not exist
Warning: Native component for "RCTFBLoginButton" does not exist
Warning: Native component for "RCTFBSendButton" does not exist
Warning: Native component for "RCTFBShareButton" does not exist
AppStateIOS is deprecated. Use AppState instead

I can report the same errors too, the latest update to react-native-fbsdk seems to have broken AppEventsLogger

+1, just pulled the lastest code have this issue

+1

+1

+1

+1

+1

+1

+1

Not sure if if it is the best way, but the workaround for this issue is:

  1. npm install rnpm -g
  2. rnpm link react-native-fbsdk
  3. remove the following lines from subspecs in ios/PodFile
    'Core',
    'Login',
    'Share',
  4. pod install
  5. go to https://developers.facebook.com/docs/ios/getting-started, download FB ios SDK, and unzip to ~/Documents/FacebookSDK
  6. open F8v2.xcworkspac with xcode, and drag Bolts.framework,FBSDKCoreKit.framework, FBSDKLoginKit.framework, FBSDKShareKit.framework in ~/Documents/FacebookSDK to Frameworks under F8V2 project.
  7. run react-native run-ios .It should work now. If have build issue, drag the three FB...Kit.framework to RCTFBSDK.xcodeproj too.

+1

+1

+1

+1

Ran into the same issue. I was able to get around the issue by the following.

42:    case 'SKIPPED_LOGIN':
43:      //AppEventsLogger.logEvent('Skip login', 1);
44:      break;

Thanks @realdubb, this helped me out!

@Jay-Li-AU Hi Jay, I am getting the build error and I have added the SDK components to both F8v2.xcworkspac and RCTFBSDK.xcodeproj

It's saying:

* BUILD FAILED *

The following build commands failed:
CompileC /Users/***/f8app/ios/build/Build/Intermediates/RCTFBSDK.build/Debug-iphonesimulator/RCTFBSDK.build/Objects-normal/x86_64/RCTFBSDKInitializer.o RCTFBSDK/core/RCTFBSDKInitializer.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/F8v2.app
Launching com.facebook.f8
com.facebook.f8: 30829

hi @msutyak, looks like you didn't follow the steps. I had the similar compiling issues as yours, but it was fixed by the instructions I mentioned.

@Jay-Li-AU I did follow the steps...where could I be going wrong? Here is what my xcode projects look like after the drag and drop. I have the frameworks in Documents/FacebookSDK. I dragged to both F8v2.xcworkspac and RCTFBSDK.xcodeproj.

screen shot 2016-10-11 at 9 54 18 am

screen shot 2016-10-11 at 9 54 57 am

@Jay-Li-AU Now I have gotten the app to build and run again, but the FB button is still not working: Cannot read property 'logInWithReadPermissions' of undefined

@msutyak for pervious compiling issue, if it is _refreshControl undeclared issue, just change it to refreshControl.

for logInWithReadPermissions undefined, I think you may forget or have problem running rnpm link react-native-fbsdk. I did a clean setup, and it's always working.

After rnpm, check HEADER_SEARCH_PATHS in project.pbxproj. It should look like(note the last line):

HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../node_modules/react-native/React/",
"$(SRCROOT)/../node_modules/react-native-fbsdk/ios/RCTFBSDK/
",
);

Had this problem too. Make sure you're linking dependencies:

  1. >> npm install rnpm -g
  2. >> rnpm link react-native-fbsdk

or, just one step:

react-native link

For me, worked like that. I didn't removed subspecs from ios/PodFile, or instaliing pod again, etc. Try it out.

I followed the instructions to a T and now I'm getting this error:
undefined is not an object (evaluating Loginmanager.loginWithReadPermissions)

npm view react-native version 0.41.2

Anyone find a resolution to that?

@tannerhallman see my comment here, hope it helps

+1

+1

+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

SanlinBlackball picture SanlinBlackball  路  5Comments

brucebnu picture brucebnu  路  4Comments

santosrai picture santosrai  路  3Comments

letientai299 picture letientai299  路  3Comments

davidtian719 picture davidtian719  路  9Comments