react-native-webrtc / react-native-callkit

#deprecated iOS 10 new CallKit framework for React Native
ISC License
122 stars 67 forks source link

Installation tip #25

Closed darknessproduction closed 6 years ago

darknessproduction commented 6 years ago

Hello guys.

I have a problem with correct installation. You can see the error below. When I try to use something like this:

    let _uuid = uuid.v4();
    RNCallKit.displayIncomingCall(_uuid, "886900000000");

Xcode error:

2018-01-18 21:57:21.495856+0200 calltravel[2858:1029881] n is not a function. (In 'n(e)', 'n' is undefined)
2018-01-18 21:57:21.496 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: n is not a function. (In 'n(e)', 'n' is undefined)
2018-01-18 21:57:21.496912+0200 calltravel[2858:1029907] Unhandled JS Exception: n is not a function. (In 'n(e)', 'n' is undefined)
2018-01-18 21:57:21.499252+0200 calltravel[2858:1029907] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: n is not a function. (In 'n(e)', 'n' is undefined)', reason: 'Unhandled JS Exception: n is not a function. (In 'n(e)', 'n' is undefined), stack:
<unknown>@405:2966
u@34:133
<unknown>@34:921
o@23:571
u@23:880
callImmediates@23:3178
value@18:2476
<unknown>@18:655
value@18:2304
flushedQueue@18:625
'
*** First throw call stack:
(0x1860dfd38 0x1855f4528 0x1860dfc80 0x104d66c08 0x104d64308 0x1860e76a0 0x185fc6820 0x185fcb22c 0x104d77790 0x104db787c 0x104db76e8 0x185a65088 0x185a65048 0x185a6ee48 0x185a6f7d8 0x185a70200 0x185a784a0 0x185d0afe0 0x185d0ac30)
libc++abi.dylib: terminating with uncaught exception of type NSException

I run that with:

        "react": "16.0.0-beta.5",
        "react-native": "0.49.3",
        "react-native-callkit": "^1.3.1",

I tried 1.3.0, 1.2.1 and I get same.

I also set up $(SRCROOT)/../node_modules/react-native-callkit/ios with recursive And my AppDelegate.m looks like this

#import "AppDelegate.h"

#import "RNCallKit.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <React/RCTPushNotificationManager.h>

#import <PushKit/PushKit.h>
#import "RNVoipPushNotificationManager.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation;

  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

 /* RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"calltravel"
                                               initialProperties:nil
                                                   launchOptions:launchOptions];*/
  // Initialise RNCallKit
  RNCallKit *rncallkit = [[RNCallKit alloc] init];

  // Initialise React Bridge with RNCallKit
  RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:jsCodeLocation
                                                                  moduleProvider:^{ return @[rncallkit]; }
                                                                   launchOptions:launchOptions];

  // Initialise React Root View with React Bridge you've just created
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                                      moduleName:@"calltravel"
                                                                      initialProperties:nil];

Sure there is also rncallkit.a in link binary with libs What am I doing wrong? help pls

ianlin commented 6 years ago

Hi @ilyadarq, from your error log I couldn't see where went wrong, please run as Debug mode so the log would be clearer.

There are two points I would guess, 1. make sure you install uuid and import it and, 2. if you are using RNCallKit > 1.2.1, you don't have to modify AppDelegate.m.

Hope it helps!

darknessproduction commented 6 years ago

Okay. The problem was with info.plist. Reference to https://github.com/ianlin/react-native-callkit/issues/20#issuecomment-356953932 Just add voip to Uibackground modes :) As he said please add it to guide, bro.

ianlin commented 6 years ago

Thanks, README updated.