r/reactnative • • May 17 '20

Objective C code - Duplicate Declaration Issue

Error: Duplicate declaration of method 'application:openURL:options:'

inFile: AppDelegate.m

I am working on an app using React-Native. That has react-native twitter Sign in and also Firebase Dynamic Links. I have no idea how objective C code works and would appreciate someone helping me out with the issue I am facing.

//Twitter Auth

- (BOOL)application:(UIApplication )app openURL:(NSURL )url options:(NSDictionary<NSString ,id> )options {

return [[Twitter sharedInstance] application:app openURL:url options:options];

// [RCTLinkingManager application:app openURL:url options:options];

}

//Dynamic Linking - React Navigation

- (BOOL)application:(UIApplication *)application

openURL:(NSURL *)url

options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options

{

return [RCTLinkingManager application:application openURL:url options:options];

}

Error: Duplicate declaration of method 'application:openURL:options:'

Thanking You!

4 Upvotes

7 comments sorted by

View all comments

Show parent comment

2

u/kechboy63 May 18 '20

Aah ok yeah ObjC’s syntax is somewhat strange if you’ve never looked at it before.

I’d really recommend to do some basic tutorials in native iOS (ObjC) and Android (Java) development to understand what goes on behind the scenes and to be able to fix bugs like these more easily. This is exactly the pitfall for many developers that I work or worked with and knowing something about it only makes you more valuable as a cross-platform developer in the future :-)

Enjoy your devving, good luck ^