FBSDK: Cannot read property loginwithreadpermissions of undefined

妖精的绣舞 提交于 2019-12-05 05:34:53

I just resolved the same error. For some reason "react-native link react-native-fbsdk" had finished for Android but not ios.

rnpm-install info Android module react-native-fbsdk is already linked rnpm-install info Linking react-native-fbsdk ios dependency rnpm-install info iOS module react-native-fbsdk has been successfully linked

Try rerunning and make sure you are linking with libRCTFBSDK.a

Following @Greg Cockroft's answer, I've noticed that I was not being able to include "libRCTFBSDK.a" on my project's "Link Binary With Libraries" because I was not including the "RCTFBSDK" library project.

So if you are on same situation do the following missing steps:

  1. Add (or drag using Finder) "/node_modules/react-native-fbsdk/ios/RCTFBSDK.xcodeproj" under your Xcode project "Libraries" group.
  2. Build "RCTFBSDK.xcodeproj" or your entire project.
  3. Add "libRCTFBSDK.a" on your project settings, under "Link Binary With Libraries".
  4. Compile/run your app. Now if you have the right JS login code, you should be able to login via Facebook's screen.

Use the function LoginManager.logInWithPermissions(['public_profile', 'email']);

Once you did this:

npm install react-native-fbsdk --save
react-native link

Download latest FacebookSDK to your ~/Documents folder.

Unzip it to ~/Documents/FacebookSDK/

Then rebuild in XCode.

Works for me.

solved by adding to metro.config.js. And make sure you have installed metro-config

const blacklist = require('metro-config/src/defaults/blacklist');

module.exports = {
    resolver: {
        blacklistRE: blacklist([
            /node_modules\/.*\/node_modules\/react-native\/.*/,
        ])
    },
};
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!