SDK Initialization


Contents

1. Initialize with SDK Domain
2. Set the SDK Resource Bundle's Path (Optional)
3. Set Root Navigation Controller (Optional)
4. Authenticate with Access Credentials
5. Log feature

The shared instance of MobileRT exposes a generic interface to allow SDK initialization, authentication, and configuration.

Create a MobileRTCSDKInitContext Object

MobileRTCSDKInitContext* initContext = [[MobileRTCSDKInitContext alloc] init];
initContext.domain = @"https://zoom.us";
// Set your Apple AppGroupID here
initContext.appGroupId = appGroupID;
// Turn on SDK logging
initContext.enableLog = YES;
initContext.locale = MobileRTC_ZoomLocale_Default;
let initContext = MobileRTCSDKInitContext()
initContext.domain = "https://zoom.us"
// Set your Apple AppGroupID here
initContext.appGroupId = appGroupID
// Turn on SDK logging
initContext.enableLog = true
initContext.locale = .default

Set the SDK Resource Bundle's Path (Optional)

This step is optional. If and only if your MobileRTC Resource Bundle is included in another bundle or framework, please use this method to set its path.

// Set resource bundle path
NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
initContext.bundleResPath = bundlePath
// Set resource bundle path
let bundlePath = Bundle.main.bundlePath
initContext.bundleResPath = bundlePath

Set Root Navigation Controller (Optional)

This step is also optional. You can skip this step if your app's Root View Controller is not a UINavigationController.

[[MobileRTC sharedRTC] setMobileRTCRootController:navigationController];
MobileRTC.shared().setMobileRTCRootController(navigationController)

Authenticate with Access Credentials

To initialize the Zoom SDK, call initialize from the shared instance of MobileRTC. Then pass in the MobileRTCSDKInitContext object you created above. Once the SDK is initialized call getAuthService to provide your JWT and MobileRTCAuthDelegate. Finally, call sdkAuth from the shared instance of MobileRTCAuthService.

MobileRTCSDKInitContext* initContext = [[MobileRTCSDKInitContext alloc] init];
initContext.domain = @"https://zoom.us";
// Set your Apple AppGroupID here
initContext.appGroupId = appGroupID;
// Turn on SDK logging
initContext.enableLog = YES;
initContext.locale = MobileRTC_ZoomLocale_Default;
if ([[MobileRTC sharedRTC] initialize:initContext]) {
MobileRTCAuthService *authService = [[MobileRTC sharedRTC] getAuthService];
if (authService) {
authService.jwtToken = JWT;
authService.delegate = authDelegate;
[authService sdkAuth];
}
}
let initContext = MobileRTCSDKInitContext()
initContext.domain = "https://zoom.us"
// Set your Apple AppGroupID here
initContext.appGroupId = appGroupID
// Turn on SDK logging
initContext.enableLog = true
initContext.locale = .default
if MobileRTC.shared().initialize(initContext) {
if let authService = MobileRTC.shared().getAuthService() {
authService.jwtToken = JWT
authService.delegate = authDelegate
authService.sdkAuth()
}
}

For information on setting up your JWT, see Authentication.

Monitor Auth Status

To monitor the status or catch errors during the initialization process, implement the onMobileRTCAuthReturn method:

- (void)onMobileRTCAuthReturn:(MobileRTCAuthError)returnValue
{
switch (returnValue) {
case MobileRTCAuthError_Success:
NSLog(@"SDK auth success");
break;
default:
NSLog(@"SDK auth failure. Error %lu", (unsigned long)returnValue);
break;
}
}
func onMobileRTCAuthReturn(_ returnValue: MobileRTCAuthError) {
switch returnValue {
case .success:
print("SDK auth successful.")
default:
print("SDK auth failed: (returnValue)")
}
}

Log Feature

You can enable the log feature by setting the enableLog parameter to true in your MobileRTCSDKInitContext object:

initContext.enableLog = YES;
initContext.enableLog = true

Once the log feature is initialized, a log file will be created inside the sandbox of your application. The following steps shows how to retrieve your log file:

Open the sandbox

In Xcode, select Devices and Simulators under Window menu:

Download sandbox contents

Locate your application and press the small gear icon, then select “Download Container”:

Select a path to store the container contents, an xcappdata file will be created.

Locate log file

Locate the xcappdata file created from the previous step, right click on the file and select “Show Package Contents”:

Inside the package contents, you will find the log file under: /AppData/tmp/

The log file has a 5MB storage capacity (fixed). Once it reaches the maximum capacity, it will auto re-record from the begining and overrider the previous data.

Need help?

If you're looking for help, try Developer Support or our Developer Forum. Priority support is also available with Premier Developer Support plans.