React Native App 的 Facebook 登录实施失败

Facebook Login implementation failing for React Native App

我一直在尝试为 React 本机应用程序实现 Facebook 登录功能。令人遗憾的是,Facebook 开发的一种语言无法正确支持其自身的功能。这是我遵循的过程:

  1. 我安装了 https://www.npmjs.com/package/react-native-fbsdk-next 包作为 npm i react-native-fbsdk-next 安装了 "^4.0.0" 这个。
  2. 我做了 pod install,它显示了一条成功消息,如下图所示:
  3. 然后我在 XCode 中打开 iOS 项目并在我的 info.plist 文件中添加:
<key>CFBundleURLTypes</key>
  <array>
      <dict>
          <key>CFBundleURLSchemes</key>
          <array>
              <string>fbMY_APP_ID</string>
          </array>
      </dict>
  </array>
  <key>FacebookAppID</key>
  <string>MY_APP_ID</string>
  <key>FacebookDisplayName</key>
  <string>MY_APP_NAME</string>
  <key>LSApplicationQueriesSchemes</key>
  <array>
    <string>fbapi</string>
    <string>fb-messenger-share-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>
  </array>
  1. 之后我打开 AppDelegate.m 并执行了以下操作:
...
#import <FBSDKCoreKit/FBSDKCoreKit.h>
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
  
  [[FBSDKApplicationDelegate sharedInstance] application:application
      didFinishLaunchingWithOptions:launchOptions];
  
  return YES;
}

- (BOOL)application:(UIApplication *)app
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
  if ([[FBSDKApplicationDelegate sharedInstance] application:app openURL:url options:options]) {
    return YES;
  }

  return NO;
}

...

然后当我 运行 应用程序 react-native run-ios 出现这个非常长的错误,我什至无法复制完整的错误,但这是该错误的最后几行:

此错误的完整日志已发布https://github.com/thebergamo/react-native-fbsdk-next/issues/11

** BUILD FAILED **

The following build commands failed: Ld /Users/chaudhrytalha/Library/Developer/Xcode/DerivedData/fbexampleapp-cbjnhmdbrulusmcwnknqvzbhuegw/Build/Products/Debug-iphonesimulator/fbexampleapp.app/fbexampleapp normal

失败消息比那个更大。

到目前为止,我尝试过的是我从头开始一个新项目确保它是 运行ning 并且我安装 react-native-fbsdk-next 然后更新 pod 和运行 应用再次开始显示这个长错误。

在 xcode 中打开您的项目并在您的项目

中创建一个空的 .swift 文件

单击下一步,您的项目将构建