Build an App


This guide will serve as a quickstart guide that will help you understand how to build a simple video app that embeds the Zoom Client using the Zoom SDK. In this app, we will program the following two features:

  1. Join a Meeting : A user with a Zoom Meeting Number and Meeting Passcode will be able to join a meeting anonymously without having to log in to the app.
  2. Start a Meeting: A user with their Zoom login credentials will be able to login and start an instant meeting as a Meeting Host.

This tutorial is targeted towards users with minimal or no experience with the Zoom iOS SDK. However, if you would like to explore and implement additional features, check out the sample apps included in the SDK package.

Sample Project

You can view the complete code for this project from this repository.

Prerequisites

  • Xcode 10.0 or later
  • An iOS Device (iOS 8 or later)
  • Meeting Number and the passcode of a Zoom meeting.
  • SDK Key and Secret, obtained by creating an SDK App. If you have not already generated these credentials, refer to the Build an SDK App to learn how to generate the SDK Key and Secret for your app.

Once you have met these prerequisites, follow the steps listed in this guide to build your first sample Zoom SDK App.

1. Create a New iOS Project

Open Xcode and click Create a new Xcode project. Choose Single View App as the template and click Next. Fill out the relevant project information such as the project name, team, organization name, choose Storyboard in the User Interface field, select Objective-C as the language and click Next. Specify where you would like to store your project and click Create. Next, connect your iOS device to your computer.

2. Import the Zoom SDK Libraries

Now that your starter project is ready, it is time to include the Zoom SDK into your project. If you have not already downloaded the Zoom iOS SDK, click one of the following links to download it:

  • Zoom iOS SDK with Device and Simulator Support : Download the SDK using this option if you’d like to run the project on a simulator. This version also supports running the project on an iOS device. However, this version of the SDK is not compatible for deployment to the App Store and is best suitable for learning and testing purposes only. You should not use this version of the SDK if you plan on building an app that is compatible for deployment on the Apple App Store.

  • Zoom iOS SDK - Device Only (Compatible with App Store) : Download the SDK using this option if you have an iOS device (iOS 8 or later) and you do not require a simulator to run your project. You should use this version of the SDK when you are building a production level app that is intended to be published on the Apple Store.

The downloaded folder includes SDK libraries and sample apps. The SDK libraries are in the lib folders located inside the zoom-sdk-ios-master folder. Navigate to where you downloaded the sdk, and select “MobileRTC.framework” and “MobileRTCResources.bundle”.

Next, drag the selected files into your Xcode project file.

In the next screen, select “Copy items if needed” and “Create folder references” in the dialog box and click “Finish”.

Next, let’s embed and sign the framework. To do so, click on the Project file > Targets: > General > Frameworks, Libraries, and Embedded Content and click the dropdown that says, “Do Not Embed” and select “Embed & Sign”.

3. Prepare Your iOS Project for SDK Compatibility

Your project is now equipped with the Zoom SDK. However, if you built your project using version 11 or higher of Xcode, you will notice SceneDelegates being added to your project by default. SceneDelegates are not compatible with the current version of Zoom SDK, so we need to remove them from the iOS project. To do this, navigate to info.plist > Application Scene Manifest and delete it.

Next, delete the SceneDelegate.m and SceneDelegate.h files from the project navigator. Lastly, navigate to the AppDelegate.m file in the project navigator and remove the following UISceneSession code if it is present in the file.

AppDelegate.m
#pragma mark - UISceneSession lifecycle
- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
    
    return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
}


- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions {

}

The Zoom SDK also does not support Bitcode, and Xcode enables it by default so we need to disable it. Navigate to your Xcode project file, select the Project > Build Settings and then, search for “Enable Bitcode” option and set the value of the option to “No”.

4. Add Project Permissions

Add the following permissions in the info.plist file to grant access to camera and microphone, needed for Zoom meetings to run on an iOS device. Navigate to the info.plist, then click the “+” button next to “Information Property List”. Search for and select “Privacy - Camera Usage Descriptions”.

In the value field, provide a description such as “To access the camera for a video meeting” to explain why you are requesting camera access. Repeat the step for “Privacy - Microphone Usage Description” and provide a description that explains why you are requesting Microphone access.

Now that the framework is installed and the project is set up, we can start coding. Navigate to the AppDelegate.h file. Since we disabled SceneDelagates, we need to add in a UIWindow to the AppDelegate. Add the following line of code in your AppDelegate.h file:


#import <UIKit/UIKit.h>


@interface AppDelegate : UIResponder <UIApplicationDelegate>

// 1. Add UIWindow
@property (strong, nonatomic) UIWindow *window;

@end

5. Initialize the SDK

The MobileRTC class exposes a generic interface to allow initialization, authentication, and configuration of the Zoom SDK. In order to use the Zoom SDK, you need to import the MobileRTC class and provide your SDK key and secret for authentication to initialize the SDK.

To do so, first, open your AppDelegate.m file and import the SDK framework by adding the following line of code:

AppDelegate.m
#import <MobileRTC/MobileRTC.h>

Next, store the SDK Key and SDK secret as non-atomic properties.

Note that your SDK Key and secret are sensitive data. We are hardcoding these values here for demonstration purposes only. For production level implementations, we recommend that you generate a JWT using your SDK Key and Secret, and you should never let your Key, Secret, or JWT be publicly accessible.

AppDelegate.m
@property (nonatomic, copy) NSString *sdkKey;
@property (nonatomic, copy) NSString *sdkSecret;

Next, let’s create a method named setupSDK that handles the initialization and authentication of the SDK. To do so, add the following code in your AppDelegate.m file:

AppDelegate.m

 // Provide SDK Key and Secret for Authorization of SDK Initialization.

- (void)setupSDK:(NSString *)sdkKey sdkSecret:(NSString *)sdkSecret {
    MobileRTCSDKInitContext *context = [[MobileRTCSDKInitContext alloc] init];
    context.domain = @"zoom.us";
    context.enableLog = YES;
// Initialize the SDK
    BOOL sdkInitSuc = [[MobileRTC sharedRTC] initialize:context];

    if (sdkInitSuc) {
       // Get Auth Service
        MobileRTCAuthService *authService = [[MobileRTC sharedRTC] getAuthService];
    
        if (authService) {
       // Set up Auth Service
            authService.clientKey = sdkKey;
            authService.clientSecret = sdkSecret;
            authService.delegate = self;
        // Call Authentication function to authenticate the SDK
            [authService sdkAuth];
        }
    }
}

Now, we need to set up a delegate to listen to the SDK authorization updates. First, let’s import the Zoom SDK library and have the AppDelegate conform to MobileRTCAuthDelegate by adding the following code to AppDelegate.h file:

AppDelegate.h
#import <UIKit/UIKit.h>
// 1. Import Zoom SDK library
#import <MobileRTC/MobileRTC.h>

// 2. Declare that AppDelegate conforms to MobileRTCAuthDelegate
@interface AppDelegate : UIResponder <UIApplicationDelegate, MobileRTCAuthDelegate>

// 3. Call setUpSDK method.
-(void)setupSDK:(NSString *)sdkKey sdkSecret:(NSString *)sdkSecret;

@property (strong, nonatomic) UIWindow *window;

@end

Next, we will set the delegate by declaring “authorizationService.delegate = self” and include delegate functions to listen for changes in the SDK authorization state in the AppDelegate.m file.

AppDelegate.m
#import "ViewController.h"
#import <MobileRTC/MobileRTC.h>

@interface AppDelegate() 

@property (nonatomic, copy) NSString *sdkKey;
@property (nonatomic, copy) NSString *sdkSecret;

@end

@implementation AppDelegate

- (void)setupSDK:(NSString *)sdkKey sdkSecret:(NSString *)sdkSecret {
    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.clientKey = sdkKey;
            authService.clientSecret = sdkSecret;
           // Set the authService delegate.
            authService.delegate = self;
            [authService sdkAuth];
        }
    }
}

// Include MobileRTCAuthDelegate methods
#pragma mark - MobileRTCAuthDelegate
/**
* To monitor the status and catch errors that might occur during the authorization process, implement the onMobileRTCAuthReturn method
*/
- (void)onMobileRTCAuthReturn:(MobileRTCAuthError)returnValue {
    switch (returnValue) {
        case MobileRTCAuthError_Success:
            NSLog(@"SDK successfully initialized.");
            break;
        case MobileRTCAuthError_KeyOrSecretEmpty:
            NSLog(@"SDK key/secret was not provided. Replace sdkKey and sdkSecret at the top of this file with your SDK key/secret.");
            break;
        case MobileRTCAuthError_KeyOrSecretWrong:
            NSLog(@"SDK key/secret is not valid.");
            break;
        case MobileRTCAuthError_Unknown:
            NSLog(@"SDK key/secret is not valid.");
            break;
        default:
            NSLog(@"SDK Authorization failed with MobileRTCAuthError: %u", returnValue);
    }
}

            NSLog(@"SDK Authorization failed with MobileRTCAuthError: %u", returnValue);
    }
}
}



Now, inside the didFinishLaunchingWithOptions, let’s provide the SDK Key and Secret values that will be passed to the setupSDK method for initialization.

In your AppDelegate.m file, add the following lines of code under the line “@ implementation App Delegate” and enter your SDK Key and SDK Secret values in “self.sdkKey” and “self.sdkSecret” properties:

AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
/*
  Obtain your SDK Key and SDK Secret and paste it here.
Your SDK Secret should NEVER be publicly accessible, only use the sdk key and secret for testing this demo app. For your production level application, you must generate a JWT using the SDK Keys and Secret on the server side instead of storing the SDK Key and SDK Secret directly on the Client.
*/
    self.sdkKey = @"";
    self.sdkSecret = @"";

    [self setupSDK:self.sdkKey sdkSecret:self.sdkSecret];
    
    return YES;
}

Compare your files with the following samples to ensure that you have everything set up properly so far:

#import <UIKit/UIKit.h>
#import <MobileRTC/MobileRTC.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate, MobileRTCAuthDelegate>

-(void)setupSDK:(NSString *)sdkKey sdkSecret:(NSString *)sdkSecret;

@property (strong, nonatomic) UIWindow *window;