react-native-callkeep icon indicating copy to clipboard operation
react-native-callkeep copied to clipboard

How to use callkeep together with Universal Links? (Duplicate declaration of method 'application:continueUserActivity:restorationHandler:')

Open marcjulianfleck opened this issue 4 years ago • 3 comments

Bug report

  • [x] I've checked the example to reproduce the issue.

  • Reproduced on:

  • [x] iOS

Description

I am using react-native-callkeep in a project together with Universal Links. The problem occurs already in the setup process of react-native-callkeep. According to the iOS Setup-Doc, it is necessary to add the following delegate to the AppDelegate.m which is called when the user tries to start a call from native Phone App:

- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler { return [RNCallKeep application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; }

However, due to the fact that I already have installed the Universal Linking I already had to add the following continueUserActivity delegate to the AppDelegate.m:

- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler { return [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; }

Both delegates can not be added, since Xcode is giving an error during compiling then. Is there a possibility to use still both delegates on the same time?

Steps to Reproduce

Do not add the delegate which is mentioned in the iOS Setup-Doc to the AppDelegate.m and try to start a call from native Phone CallingApp. No "didReceiveStartCallAction"-event will then be fired.

Versions

- Callkeep: 4.2.0
- React Native: 0.64.2
- iOS: 14.17.1
- Phone model: iPhone X (physical device)

Logs

Compiler Error

marcjulianfleck avatar Aug 26 '21 10:08 marcjulianfleck

Facing this same issue on react native version 0.63.4 @marcjulianfleck Did you manage to find the solution? If yes, Please let me know.

AvibhavChoudhary avatar Sep 20 '21 13:09 AvibhavChoudhary

@AvibhavChoudhary try this

- (BOOL)application:(UIApplication *)application
 continueUserActivity:(nonnull NSUserActivity *)userActivity
   restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
{
  BOOL handledCK = [RNCallKeep application:application
                    continueUserActivity:userActivity
                      restorationHandler:restorationHandler];
  
  BOOL handledLM = [RCTLinkingManager application:application
                      continueUserActivity:userActivity
                        restorationHandler:restorationHandler];
  
  return handledCK || handledLM;
}

found it here https://stackoverflow.com/questions/38945790/appdelegate-m-for-both-fbsdk-and-linkingmanager/38945881

I think issue can be closed

redexp avatar Sep 27 '21 11:09 redexp

Thanks @redexp

AvibhavChoudhary avatar Sep 28 '21 06:09 AvibhavChoudhary