No known class method for selector 'application:openURL:options:sourceApplication:annotation'

1.1k views Asked by At

I am integrating Fitbit into my react-native app and there is a piece of code that I should add to my AppDelegate.m:

#import "RCTLinkingManager.h"


@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
      openURL:(NSURL *)url
      sourceApplication:(NSString *)sourceApplication
      annotation:(id)annotation {
        return [RCTLinkingManager
                application:application
                openURL:url
                sourceApplication:sourceApplication
                annotation:annotation];
      }

but I already have that set up that handles FB login and firebase linking and maybe something else:

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

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

    return NO;
}

and when I'm trying to combine them into that:

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

     if ([RCTLinkingManager application:app
           openURL:URL
           options:options
           sourceApplication:(NSString *)sourceApplication
           annotation:(id)annotation ]) {
       return YES;
     }

     return NO;
 }

I'm getting the error: No known class method for selector 'application:openURL:options:sourceApplication:annotation'

Is it mean that sourceApplication and annotation are already included into options?

Any help welcome

1

There are 1 answers

3
BoygeniusDexter On

you should call the FBSDKApplicationDelegate differently:

    if ([[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:annotation]) {
        return YES;
    }