Native SDKs
Preface
Overview
Build your first Zoom app
Techniques
Mastering Zoom SDK
1. SDK Initialization
2. Start / Join Meeting
3. In-Meeting Function
4. Other Features
SDK Reference
Resource
Get Help
Additional Tips
Hybrid Frameworks Support

SDK Initialization


Contents

1. Initialize the Zoom SDK

2. Log feature

Main Thread

Please note that SDK initialization and all API call must run in Main Thread.

1. Intialize the Zoom SDK

To integrate with our Zoom SDK and have all Zoom services working, the Zoom SDK instance needs to be initialized. The MobileRTC object exposes a generic interface to allow initialization, authentication, and configuration.

To initialize the object, firstly you need to implements the didFinishLaunchingWithOptions method in AppDelegate.m.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  ...
}

Next, implement with the following steps to initialize Zoom SDK:

Step 1: Initialize with SDK Domain

MobileRTC = Zoom SDK

You will see the term “MobileRTC” in our iOS library, it is the technical name of our SDK library, you can treat it as the term “Zoom SDK”.

//1. initSDK
[MobileRTC initializeWithDomain:kSDKDomain enableLog:NO];
Please do not use raw IP address as the web domain

Please do not use raw IP address as the web domain as it will cause vulnerability issues. If you would like to learn why, please see our security practices for more information.

Step 2: 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.

//2. Set MobileRTC Resource Bundle path
//Note: This step is optional, If MobileRTCResources.bundle is included in other bundle/framework, use this method to set the path of MobileRTCResources.bundle, or just ignore this step
SString *bundlePath = [[NSBundle mainBundle] bundlePath];
[[MobileRTC sharedRTC] setMobileRTCResPath:bundlePath];

Step 3: Set Root Navigation Controller (Optional)

This step is also optional. You can skip this step if and only if your app’s Root View Controller is not a UI Navigation Controller.

...
MainViewController *mainVC = [[[MainViewController alloc] init] autorelease];
UINavigationController *navVC = [[[UINavigationController alloc] initWithRootViewController:mainVC] autorelease];
navVC.navigationBarHidden = YES;
...
//3. Set Root Navigation Controller
//Note: This step is optional, If app’s rootViewController is not a UINavigationController, just ignore this step.
[[MobileRTC sharedRTC] setMobileRTCRootController:navVC];

Step 4: Initialize Zoom SDK by authenticating SDK keys & secrets

To initialize Zoom SDK, firstly you need to call getAuthService from MobileRTC, and insert parameters. In the end, pass sdkAuth method to authService to perform an authentication process on initializing Zoom SDK:

- (void)onMobileRTCAuthReturn:(MobileRTCAuthError)returnValue
{
   NSLog(@"onMobileRTCAuthReturn %d", returnValue);
    
    if (returnValue != MobileRTCAuthError_Success)
    {
        NSString *message = [NSString stringWithFormat:NSLocalizedString(@"SDK authentication failed, error code: %zd", @""), returnValue];
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:message delegate:self cancelButtonTitle:NSLocalizedString(@"OK", @"") otherButtonTitles:NSLocalizedString(@"Retry", @""), nil];
        [alert show];
    }
}

The properties in the method (from first to last):

Properties Definition
delegate The property that acts as the delegate of the receiving auth/login events.
clientKey The key value is used during the authorization code grant.
clientSecret The secret value is used during the authorization code grant.

If you would like to see the status or catch the errors during the initialization process, you can implement the onMobileRTCAuthReturn method:

- (void)onMobileRTCAuthReturn:(MobileRTCAuthError)returnValue
{
   NSLog(@"onMobileRTCAuthReturn %d", returnValue);
    
    if (returnValue != MobileRTCAuthError_Success)
    {
        NSString *message = [NSString stringWithFormat:NSLocalizedString(@"SDK authentication failed, error code: %zd", @""), returnValue];
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:message delegate:self cancelButtonTitle:NSLocalizedString(@"OK", @"") otherButtonTitles:NSLocalizedString(@"Retry", @""), nil];
        [alert show];
    }
}
(returnValue == MobileRTCAuthError_Success) is the pre-requisite of every other services

You will not be able to use any other services(such as login, logout, join meeting, start meeting, etc.) if you do not receive a MobileRTCAuthError_Success value as the returnValue in the onMobileRTCAuthReturn method.

2. Log Feature

The log feature is introduced with SDK v4.3.30728.0118, you can enable the log feature when initializing Zoom SDK with the following method:

//1. initSDK, must be called at the very beginning of the didFinishLaunchingWithOption method.
[MobileRTC initializeWithDomain:kSDKDomain enableLog:YES];
Set enableLog: YES but not log?

Please beware that you must call [ MobileRTC initializeWithDomain:kSDKDomain enableLog: YES] method at the very beginning of your didFinishLaunchingWithOption, and you must not call any other methods that involve sharedRTC before you call [ MobileRTC initializeWithDomain:kSDKDomain enableLog: YES] method because calling methods that involve sharedRTC will initialize a MobileRTC instance with log feature disabled.

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:

Step 1: Open the sandbox

In Xcode, select Devices and Simulators under Window menu:

Step 2: 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.

Step 3: 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.