iOS Installation

August 14, 2022 ยท View on GitHub

Automatic linking

react-native link react-native-callkeep

Installation with Cocoa pods

Include in a Podfile in your react-native ios directory:

pod 'RNCallKeep', :path => '../node_modules/react-native-callkeep'

Then:

cd ios
pod install

Manual installation

1. Add Files To Project

1.1. In Xcode: Right click Libraries โžœ Add Files to [Your project name].

iOS Add Library

1.2. Choose node_modules/react-native-callkeep/ios/RNCallKeep.xcodeproj then click Add.

iOS Select Library

You'll now have the Library included.

iOS Libraries

2.1. Click on Build Phases tab, then open Link Binary With Libraries.

iOS Bild Phases

2.2. Add libRNCallKeep.a.

iOS Add build target

Common installation steps

1.1. Click on Build Phases tab, then open Link Binary With Libraries.

1.2. Add CallKit.framework and Intents.framework (and mark it Optional).

iOS Other libraries

2. Add header search path

2.1. Click on Build Settings tab, then search for Header Search Paths.

2.2. Add $(SRCROOT)/../node_modules/react-native-callkeep/ios/RNCallKeep.

iOS Search Paths

3. Allow voip background

3.1. Open Info.plist file and add voip in UIBackgroundModes.

iOS info.plist

By editing this file with a text editor, your should see:

<key>UIBackgroundModes</key>
<array>
  <string>voip</string>
</array>

4. Updating AppDelegate.m

4.1. Import Library:

+ #import "RNCallKeep.h"

4.2. Handling User Activity.

This delegate will be called when the user tries to start a call from native Phone App.

Add it before the @end tag.

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