HomeiOS Developmentios - React Native: 'FBSDKApplicationDelegate' undeclared identifier error in AppDelegate.mm

ios – React Native: ‘FBSDKApplicationDelegate’ undeclared identifier error in AppDelegate.mm


Im constructing a react native app and Im making an attempt to put in and arrange the fbsdk-next pack and have adopted the steps a number of instances now however nonetheless get the identical error: error: use of undeclared identifier 'FBSDKApplicationDelegate' if ([[FBSDKApplicationDelegate sharedInstance] software:app openURL:url choices:choices]) { ^

I’ve tried this answer however nonetheless the identical error..

My AppDelegate.mm file appears like this:

#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <AuthenticationServices/AuthenticationServices.h>
#import <SafariServices/SafariServices.h>
#import <FBSDKCoreKit/FBSDKCoreKit-Swift.h>
#import <React/RCTLinkingManager.h>

@implementation AppDelegate

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

  if ([RCTLinkingManager application:app openURL:url options:options]) {
    return YES;
  }
  
  return NO;
}

- (BOOL)software:(UIApplication *)software didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  self.moduleName = @"AppName";
  // You possibly can add your customized preliminary props within the dictionary under.
  // They are going to be handed all the way down to the ViewController utilized by React Native.
  self.initialProps = @{};

  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
  return [self getBundleURL];
}

- (NSURL *)getBundleURL
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
  return [[NSBundle mainBundle] URLForResource:@"essential" withExtension:@"jsbundle"];
#endif
}

@finish

and I’ve this in my Information.plist:

<key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fb<my-id></string>
            </array>
        </dict>
    </array>
    <key>CFBundleVersion</key>
    <string>$(CURRENT_PROJECT_VERSION)</string>
    <key>FacebookAppID</key>
    <string><my-id></string>
    <key>FacebookClientToken</key>
    <string><my-token></string>
    <key>FacebookDisplayName</key>
    <string><app-name></string>
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>fbapi</string>
        <string>fb-messenger-share-api</string>
    </array>

I’ve added the linking manually aswell:

pod 'react-native-fbsdk-next', :path => '../node_modules/react-native-fbsdk-next'

and tried the opposite method:

installer.aggregate_targets.first.user_project.native_targets.every do |goal|
      goal.build_configurations.every do |config|
        config.build_settings['LIBRARY_SEARCH_PATHS'] = ['$(inherited)', '$(SDKROOT)/usr/lib/swift']
      finish
    finish

Anybody have a repair for this?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments