alia
alia

Reputation: 300

No known class method (facebook sdk integration)

I'm trying to add the react-native-fbsdk-next into my react-native app. The documentation says to add the following lines to the AppDelegate.m file to enable AEM (Aggregated Event Measurement)

#import <FBAEMKit/FBAEMKit.h>

[FBAEMReporter configureWithNetworker:nil appID:{app-id}];
[FBAEMReporter enable];
[FBAEMReporter handleURL:url]

After I added these lines of code like this:

(BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
[FBAEMReporter configureWithNetworker:nil appID:123456789]; // in the code I use the real app Id
[FBAEMReporter enable];
[FBAEMReporter handleURL:url];
  #if defined(EX_DEV_LAUNCHER_ENABLED)
  if ([EXDevLauncherController.sharedInstance onDeepLink:url options:options]) {
    return true;
  }
  #endif
  return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options];
}

the build fails with the following error no known class method for selector 'configureWithNetworker:appID:'. I can't find or understand how to fix this issue, the documentation doesn't provide any additional information/steps to follow. Any advise or help is greatly appreciated.

Upvotes: 2

Views: 1395

Answers (1)

joneswah
joneswah

Reputation: 2798

It looks like a mistake in the react-native-fbsdk-next README

the underlying method signature in the native Facebook iOS SDK is:

+ (void)configureWithNetworker:(nullable id<FBAEMNetworking>)networker
                     appID:(nullable NSString *)appID
                  reporter:(nullable id<FBSKAdNetworkReporting>)reporter;

So the call should be:

  [FBAEMReporter configureWithNetworker:nil appID:@"1234556" reporter:nil];
  [FBAEMReporter enable];
  [FBAEMReporter handleURL:url];

(note that appID is a string, also I am unfamiliar with the SKAdNetworkReporter but it is nullable so it builds passing in nil).

Upvotes: 4

Related Questions