In obj C, I have added a UIViewcontroller from which zoom sdk will be intiated in viewDidLoad method as below,
// ZoomViewController.m
@implementation ZoomViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self setupSDK:@"MY_APP_JWT_TOKEN"];
}
- (void)setupSDK:(NSString *)jwtToken {
MobileRTCSDKInitContext *context = [[MobileRTCSDKInitContext alloc] init];
context.domain = @"zoom.us";
context.enableLog = YES;
BOOL sdkInitSuc = [[MobileRTC sharedRTC] initialize:context];
if (sdkInitSuc) {
MobileRTCAuthService *authService = [[MobileRTC sharedRTC] getAuthService];
if (authService) {
authService.delegate = self;
authService.jwtToken = jwtToken;
[authService sdkAuth];
}
}
}
- (void)onMeetingStateChange:(MobileRTCMeetingState)state {
NSLog(@"Meeting state: %ld", (long)state);
}
- (void)onMeetingReady:(MobileRTCMeetingState)state {
NSLog(@"Meeting ready: %ld", (long)state);
}
-(void)startzoommeeting {
MobileRTCMeetingService *meetingService = [[MobileRTC sharedRTC] getMeetingService];
if (meetingService) {
meetingService.delegate = self;
[meetingService customizeMeetingTitle:@"Sample meeting title"];
MobileRTCMeetingStartParam4WithoutLoginUser *user = [[MobileRTCMeetingStartParam4WithoutLoginUser alloc] init];
user.userType = MobileRTCUserType_APIUser;
user.meetingNumber = kMeetingNumber;
user.userName = KuserName;
user.isAppShare = NO;
user.zak = @"MY_APP_JWT_TOKEN";
[meetingService startMeetingWithStartParam: user];
};
}
#pragma mark - MobileRTCAuthDelegate
- (void)onMobileRTCAuthReturn:(MobileRTCAuthError)returnValue {
switch (returnValue) {
case MobileRTCAuthError_Success:
[self startzoommeeting]; // After the SDK initiation success
break;
case MobileRTCAuthError_Unknown:
NSLog(@"Client JWT Token authentication is invalid.");
break;
default:
NSLog(@"SDK Authorization failed with MobileRTCAuthError: %u", returnValue);
}
}
// ZoomViewController.h
#import <UIKit/UIKit.h>
#import <MobileRTC/MobileRTC.h>
#import <MobileCoreServices/MobileCoreServices.h>
@interface ViewController : UIViewController <MobileRTCMeetingServiceDelegate, MobileRTCAuthDelegate>
@end
// ZoomViewControllerBridge.m -- bridge_file
RCT_EXPORT_METHOD(presentZoomView) {
dispatch_async(dispatch_get_main_queue(), ^{
UIWindow *window = [[[UIApplication sharedApplication] windows] firstObject];
if (window) {
UIViewController *rootViewController = window.rootViewController;
if ([rootViewController isKindOfClass:[UINavigationController class]]) {
UINavigationController *navController = (UINavigationController *)rootViewController;
ZoomViewController *zoomVC = [[ZoomViewController alloc] init];
[navController pushViewController:zoomVC animated:YES];
}
});
}
In React Native , I'm calling the native code through bridge as below
import { NativeModules } from 'react-native';
const { ZoomViewControllerBridge } = NativeModules;
ZoomViewControllerBridge.presentZoomView();
The Zoom SDK initialisation was successful, and the following line of code meetingService startMeetingWithStartParam: user was executed; however, nothing happens after that. When I try the same flow in native code, the delegate method onMeetingStateChange is called, but it's not getting called through the bridge.
What am I missing?