# Classroom SDK & Proctor SDK (/en/realtime-media/flexible-classroom/build/integrate-the-sdks/integrate-flexible-classroom/ios)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

This page introduces how to add Flexible Classroom into your app.

      
  
      
    ## iOS [#ios]

    ## Understand the tech [#understand-the-tech-1]

    Flexible Classroom contains the following libraries:

    * `AgoraClassroomSDK`: The integration layer that connects `AgoraEduUI` and `AgoraEduCore`. `AgoraClassroomSDK` is an open sourced project and is released on GitHub and CocoaPods.
    * `AgoraEduUI`: This library contains the code for the UI; it also includes all the texts and resource files used by Flexible Classroom. `AgoraEduCore` provides this library with the functionality and data in Flexible Classroom. `AgoraEduUI` is an open source project and is released on GitHub and CocoaPods.
    * `AgoraProctorSDK`: The integration layer of the Flexible Classroom proctoring use-case, connecting `AgoraProctorUI` and `AgoraEduCore`. `AgoraProctorSDK` is an open sourced project on GitHub and CocoaPods.
    * `AgoraProctorUI`: The interaction layer code for the Flexible Classroom proctoring use-case. It includes the copy information and resource files used in the interaction layer. `AgoraEduCore` provides this layer with the capabilities and data. `AgoraProctorUI` is an open sourced project on GitHub and CocoaPods.
    * `AgoraEduCore`: This library provides the capabilities and data in Flexible Classroom. `AgoraEduCore` is a closed-source library and is released on CocoaPods as a binary package.
    * `Widget`: This library provides independent plugins that include both interfaces and functions. `AgoraClassroomSDK` injects these plugins into Flexible Classroom. Widgets can communicate with each other.

    The following figure shows the structure of Flexible Classroom:

    ![Flexible Classroom iOS SDK structure](https://web-cdn.agora.io/docs-files/1681291532244)

    ## Prerequisites [#prerequisites]

    Use [CocoaPods](https://guides.cocoapods.org/using/getting-started.html#getting-started) v1.10 or higher for the integration methods described below.

    After installation, enter the following command in the terminal to see if the installation was successful:

    ```bash
    pod --version
    ```

    For example, if you install version 1.11.3, the terminal should print the following information:

    ```bash
    1.11.3
    ```

    ## Education use-case [#education-use-case]

    ### Flexible Classroom in the integrated education use-case (default) [#flexible-classroom-in-the-integrated-education-use-case-default]

    To use the default UI of Flexible Classroom, take the following steps to add remote dependencies and integrate the whole Flexible Classroom through CocoaPods:

    1. Open your project with Xcode and add the following code to the project's `Podfile`:

       ```bash
       # third-party libs
       pod 'SwifterSwift',   '5.2.0'
       pod 'Masonry',        '1.1.0'
       pod 'SDWebImage',     '5.12.0'
       pod 'AgoraRtcEngine_Special_iOS', '3.7.2.133'
       pod 'Whiteboard',     :git => 'https://github.com/netless-io/Whiteboard-iOS', :branch => 'effect-mixing'
       # open source libs
       pod 'AgoraClassroomSDK_iOS', '2.8.111'
       pod 'AgoraWidgets',          '2.8.111'
       ```

    2. Navigate into the project directory in the terminal and run `pod install` to install the dependencies. For example,
       the following will be printed for v2.80.20:

       ```bash
       Analyzing dependencies
       Downloading dependencies
       Installing AgoraClassroomSDK_iOS (2.8.20)
       Installing AgoraEduCore (2.8.20)
       Installing AgoraEduUI (2.8.20)
       Installing AgoraLog (1.0.2)
       Installing AgoraMediaPlayer_iOS (1.3.0)
       Installing AgoraRtcEngine_iOS (3.7.2)
       Installing AgoraRtm_iOS (1.4.8)
       Installing AgoraUIBaseViews (2.8.0)
       Installing AgoraWidget (2.8.0)
       Installing AgoraWidgets (2.8.20)
       Installing Agora_Chat_iOS (1.0.6)
       Installing AliyunOSSiOS (2.10.8)
       Installing Armin (1.1.0)
       Installing CocoaLumberjack (3.6.1)
       Installing Masonry (1.1.0)
       Installing NTLBridge (3.1.5)
       Installing Protobuf (3.17.0)
       Installing SDWebImage (5.12.0)
       Installing SSZipArchive (2.4.2)
       Installing SwifterSwift (5.2.0)
       Installing Whiteboard (2.16.51)
       Installing YYModel (1.0.4)
       Generating Pods project
       Integrating client project
       ```

    3. Import the header files using the matching code for the programming language of your project:

       * For Swift projects:
         ```swift
         // Swift
         import AgoraClassroomSDK_iOS
         ```

       * For Objective-C projects:
         ```objc
         // Objective-C
         import <AgoraClassroomSDK_iOS/AgoraClassroomSDK.h>
         ```

    4. To launch the classroom in the education use-case, call [AgoraClassroomSDK.launch](/en/api-reference/api-ref/flexible-classroom/classroom-sdk#launch). Sample code:

       * For Swift projects:
         ```swift
         let launchConfig = AgoraEduLaunchConfig(userName: userName,  // The user name
                                                 userUuid: userUuid,  // The user ID
                                                 userRole: userRole,  // User roles: 1 is teacher, 2 is student
                                                 roomName: roomName,  // The room name
                                                 roomUuid: roomUuid,  // The room ID
                                                 roomType: roomType,  // The room type, 0: One-to-one interactive teaching, 2: Big class, 4: Online interactive small class
                                                 appId: appId, // The App ID
                                                 token: token,  // In a test environment, you can use a temporary Signaling token; in a production or a security environment, Agora strongly recommends using a server-generated Signaling token instead.
                                                 startTime: nil,  // The starting time of the class
                                                 duration: nil,  // The class duration
                                                 region: region,  // The area
                                                 mediaOptions: mediaOptions,  // Media stream related settings
                                                 userProperties: nil)  // User properties defined by the developer

         AgoraClassroomSDK.setDelegate(self)
         AgoraClassroomSDK.launch(launchConfig, success: launchSuccessBlock, failure: failureBlock)
         ```

       * For Objective-C projects:
         ```objc
         AgoraEduLaunchConfig *launchConfig =
         [[AgoraEduLaunchConfig alloc] initWithUserName:userName // The user name
                                               userUuid:userUuid  // The user ID
                                               userRole:userRole  // User roles: 1 is teacher, 2 is student
                                               roomName:roomName  // The room name
                                               roomUuid:roomUuid  // The room ID
                                               roomType:roomType  // The room type, 0: One-to-one interactive teaching, 2: Big class, 4: Online interactive small class
                                               appId:appId // The App ID
                                               token:token  // In a test environment, you can use a temporary Signaling token; in a production or security environment,Agora strongly recommends using a server-generated Signaling token instead.
                                               startTime:nil  // The starting time of the class
                                               duration:nil  // The class duration
                                               region:region  // The area
                                               mediaOptions:mediaOptions  // Media stream-related settings
                                               userProperties:nil];  // User properties defined by the developer

         [AgoraClassroomSDK setDelegate:self];

         [AgoraClassroomSDK launch:launchConfig
                           success:successBlock
                           failure:failureBlock];

         ```

       The sample code requires passing in `rtmToken`. You can refer to [Generate a Signaling token](/en/realtime-media/flexible-classroom/build/manage-agora-account#generate-temporary-tokens) to learn what Signaling token is, how to get a temporary Signaling token for testing purposes, and how to generate a Signaling token from the server. In a production environment, to ensure security, you need to deploy and generate a Token on the server. The `userId` passed in the generated token must be consistent with the `userUuid` parameter of the `launch` method. Otherwise, the generated token will be invalid.

    5. (Optional) Customize the display mode (bright/dark) and language (Chinese/English) of the interface for education use-case.

       * For Swift projects:

         ```swift
         import AgoraUIBaseViews         /* Import the `AgoraUIBaseViews` library. The library provides two variables for customizing display mode and language: agora_ui_mode and agora_ui_language.*/
         agora_ui_mode = .agoraLight     /* Set the interface display mode, which can be set to agoraLight or agoraDark. The default is agoraLight. */
         agora_ui_language = "zh-Hans"   /* Set the interface language, which can be set to "zh-Hans" or "en". If not set, the interface language follows the system language. */
         ```

       * For Objective-C projects:

         ```objc
         /* Import the AgoraUIBaseViews library. The library provides two variables for customizing display mode and language: agora_ui_mode and agora_ui_language*/
         #import <AgoraUIBaseViews/AgoraUIBaseView-Swift.h>
         agora_ui_mode = AgoraUIModeAgoraLight              /* Set the interface display mode, which can be set to AgoraUIModeAgoraLight or AgoraUIModeAgoraDark. The default is AgoraUIModeAgoraLight.*/
         agora_ui_language = @"zh-Hans"                     /* Set the interface language, which can be set to "zh-Hans" or "en". If not set, the interface language follows the system language.*/
         ```

    6. Call the `AgoraClassroomSDK.exit()` method to close the Flexible classroom in the education use-case.

       * For Swift projects:

         ```swift
         AgoraClassroomSDK.exit()
         ```

       * For Objective-C projects:

         ```objc
         [AgoraClassroomSDK exit];
         ```

    ### Integrate and customize [#integrate-and-customize]

    To customize Flexible Classroom in the education use-case, download the source code from GitHub:

    1. Run the following commands to clone [CloudClass-iOS](https://github.com/AgoraIO-Community/CloudClass-iOS) and [apaas-extapp-ios](https://github.com/AgoraIO-Community/apaas-extapp-ios) projects locally. Switch to the branch of the version you need (the default is the latest version branch):

       ```bash
       git clone https://github.com/AgoraIO-Community/CloudClass-iOS.git
       ```

       ```bash
       git clone https://github.com/AgoraIO-Community/apaas-extapp-ios.git
       ```

    2. Use `git remote add <shortname> <url>` to add a remote repository for `CloudClass-iOS` and `apaas-extapp-ios` pointing to your project repository, and push the required branches.

    3. Add the following dependencies in your project `Podfile` to reference the libraries `AgoraClassroomSDK_iOS.podspec` and `AgoraEduUI.podspec` in the CloudClass-iOS project and `AgoraWidgets.podspec` in apaas-extapp-ios.

       ```bash
       # third-party libs
       pod 'SwifterSwift',   '5.2.0'
       pod 'Masonry',        '1.1.0'
       pod 'SDWebImage',     '5.12.0'
       pod 'AgoraRtcEngine_Special_iOS', '3.7.2.133'
       pod 'Whiteboard',     :git => 'https://github.com/netless-io/Whiteboard-iOS', :branch => 'effect-mixing'
       # open source libs
       pod 'AgoraClassroomSDK_iOS', '2.8.111'
       pod 'AgoraWidgets',          '2.8.111'
       ```

    4. Enter the project directory in the terminal and run the `pod install`  command.

    After the installation is completed, refer to [Customize the classroom UI](/en/realtime-media/flexible-classroom/build/customize-the-ui-and-plugins/customize-classroom) to understand the open source layer design ideas and modify the source code to customize the use-case.

    ## Proctoring use-case [#proctoring-use-case]

    ### Flexible Classroom in the integrated proctoring use-case [#flexible-classroom-in-the-integrated-proctoring-use-case]

    To use the default UI of Flexible Classroom, take the following steps to add remote dependencies and integrate the whole Flexible Classroom through CocoaPods:

    1. Open your project with Xcode and add the following code to the project's `Podfile`:

       ```bash
       # third-party libs
       pod 'SwifterSwift',     '5.2.0'
       pod 'Masonry',          '1.1.0'
       pod 'SDWebImage',       '5.12.0'
       pod 'AgoraRtcEngine_Special_iOS', '3.7.2.133'
       # open source libs
       pod 'AgoraProctorSDK',  '1.0.2'
       ```

    2. Navigate into the project directory in the terminal and run `pod install` to install the dependencies. For example,
       the following will be printed for v2.80.20:

       ```bash
       Analyzing dependencies
       Downloading dependencies
       Installing AgoraProctorSDK (1.0.0)
       Installing AgoraProctorUI (1.0.0)
       Installing AgoraEduCore (2.8.20)
       Installing AgoraLog (1.0.2)
       Installing AgoraMediaPlayer_iOS (1.3.0)
       Installing AgoraRtcEngine_iOS (3.7.2)
       Installing AgoraRtm_iOS (1.4.8)
       Installing AgoraUIBaseViews (2.8.0)
       Installing AgoraWidget (2.8.0)
       Installing AliyunOSSiOS (2.10.8)
       Installing Armin (1.1.0)
       Installing CocoaLumberjack (3.6.1)
       Installing Masonry (1.1.0)
       Installing Protobuf (3.17.0)
       Installing SDWebImage (5.12.0)
       Installing SSZipArchive (2.4.2)
       Installing SwifterSwift (5.2.0)
       Installing YYModel (1.0.4)
       Generating Pods project
       Integrating client project
       ```

    3. Import the header files using the matching code for the programming language of your project:

       * For Swift projects:
         ```swift
         import AgoraProctorSDK
         ```

       * For Objective-C projects:
         ```objc
         #import <AgoraProctorSDK/AgoraProctorSDK.h>
         ```

    4. To launch the classroom in the proctoring use-case, call [AgoraProctorSDK.launch](/en/api-reference/api-ref/flexible-classroom/proctor-sdk). Sample code:

       * For Swift projects:
         ```swift
         let launchConfig = AgoraProctorLaunchConfig(userName: userName,  // The user name
                                                     userUuid: userUuid,  // The user ID
                                                     userRole: userRole,  // The user roles
                                                     roomName: roomName,  // The room name
                                                     roomUuid: roomUuid,  // The room ID
                                                     appId: appId, // The App ID
                                                     token: token,  // In a test environment, you can use a temporary Signaling token; in a production or a security environment, Agora strongly recommends using a server-generated Signaling token instead.
                                                     region: region,  // The area
                                                     mediaOptions: mediaOptions,  // Media stream related settings
                                                     userProperties: nil)  // User properties defined by the developer

         let proctor = AgoraProctorSDK(launchConfig,
                                           delegate: self)

         proctor.launch(success: successBlock, failure: failureBlock)
         ```

       * For Objective-C projects:
         ```objc
         AgoraProctorLaunchConfig *launchConfig =
         [[AgoraProctorLaunchConfig alloc] initWithUserName:userName // The user name
                                                   userUuid:userUuid  // The user ID
                                                   userRole:userRole  // User roles: 1 is teacher, 2 is student
                                                   roomName:roomName  // The room name
                                                   roomUuid:roomUuid  // The room ID
                                                   appId:appId // The App ID
                                                   token:token  // In a test environment, you can use a temporary Signaling token; in a production or security environment,Agora
                                                   region:region  // The area
                                                   mediaOptions:mediaOptions  // Media stream-related settings
                                                   userProperties:nil];  // User properties defined by the developer

         AgoraProctorSDK *proctor = [[AgoraProctorSDK alloc] init:launchConfig
                                                                    delegate:self];

         [proctor launch:successBlock
                   failure:failureBlock];
         ```

       The sample code requires passing in `rtmToken`. You can refer to [Generate a Signaling token](/en/realtime-media/flexible-classroom/build/manage-agora-account#generate-temporary-tokens) to learn what Signaling token is, how to get a temporary Signaling token for testing purposes, and how to generate a Signaling token from the server. In a production environment, to ensure security, you need to deploy and generate a Token on the server. The `userId` passed in the generated token must be consistent with the `userUuid` parameter of the `launch` method. Otherwise, the generated token will be invalid.

    5. (Optional) Customize the display mode (bright/dark) and language (Chinese/English) of the interface for proctoring use-case.

       * For Swift projects:

         ```swift
         import AgoraUIBaseViews         /* Import the `AgoraUIBaseViews` library. The library provides two variables for customizing display mode and language: agora_ui_mode and agora_ui_language.*/
         agora_ui_mode = .agoraLight     /* Set the interface display mode, which can be set to agoraLight or agoraDark. The default is agoraLight. */
         agora_ui_language = "zh-Hans"   /* Set the interface language, which can be set to "zh-Hans" or "en". If not set, the interface language follows the system language. */
         ```

       * For Objective-C projects:

         ```objc
         /* Import the AgoraUIBaseViews library. The library provides two variables for customizing display mode and language: agora_ui_mode and agora_ui_language*/
         #import <AgoraUIBaseViews/AgoraUIBaseView-Swift.h>
         agora_ui_mode = AgoraUIModeAgoraLight              /* Set the interface display mode, which can be set to AgoraUIModeAgoraLight or AgoraUIModeAgoraDark. The default is AgoraUIModeAgoraLight.*/
         agora_ui_language = @"zh-Hans"                     /* Set the interface language, which can be set to "zh-Hans" or "en". If not set, the interface language follows the system language.*/
         ```

    6. To close the Flexible Classroom in a proctoring scenario, release the `AgoraProctorSDK` object:

       * For Objective-C projects:

         ```objc
         proctorSDK = nil;
         ```

       * For Swift projects:

         ```swift
         proctorSDK = nil
         ```

    ### Integrate and customize [#integrate-and-customize-1]

    To customize Flexible Classroom in the proctoring use-case, download the source code from GitHub:

    1. Run the following commands to clone [proctor-ios](https://github.com/AgoraIO-Community/proctor-ios) project locally. Switch to the branch of the version you need (the default is the latest version branch):

       ```bash
       git clone https://github.com/AgoraIO-Community/proctor-ios.git
       ```

    2. Use `git remote add <shortname> <url>` to add the remote `proctor-ios` repository pointing to your project repository, and push the required branches.

    3. Add the following dependencies in your project `Podfile` to reference the `AgoraProctorSDK.podspec` and `AgoraProctorUI.podspec` libraries.

       ```bash
       # third-party libs
       pod 'SwifterSwift',     '5.2.0'
       pod 'Masonry',          '1.1.0'
       pod 'SDWebImage',       '5.12.0'
       pod 'AgoraRtcEngine_Special_iOS', '3.7.2.133'
       # open source libs
       pod 'AgoraProctorSDK',  '1.0.2'
       ```

    4. Enter the project directory in the terminal and run the `pod install`  command.

       After the installation is completed, refer to [Customize the classroom UI](/en/realtime-media/flexible-classroom/build/customize-the-ui-and-plugins/customize-classroom) to understand the open source layer design ideas and modify the source code to customize the use-case.

    ## Considerations [#considerations]

    After integration, add the following keys to your project's `Info.plist` file to request the necessary permissions for running Flexible Classroom:

    * **Privacy – Camera Usage Description**
    * **Privacy – Microphone Usage Description**
    * **Privacy – Photo Library Additions Usage Description**
    * **Privacy – Photo Library Usage Description**

    In Xcode 14.0 and later:

    * **If you see the `AgoraEduUI-AgoraEduUI` bundle signature error** (`bundleRequire Signature`), add the following to your `Podfile`:

      ```ruby
      post_install do |installer|
        installer.pods_project.targets.each do |target|
          target.build_configurations.each do |config|
            if target.respond_to?(:product_type) && target.product_type == "com.apple.product-type.bundle"
              config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
            end
          end
        end
      end
      ```

    * **If you see the `Symbol not found: (__ZN5swift34swift50override_conformsToProtocol...)` error in `Armin.framework/Armin`,** add the following to your `Podfile`:

      ```ruby
      low_version_target_names = ["Armin", "YYModel", "Masonry", "NTLBridge", "CocoaLumberjack", "AliyunOSSiOS"]

      post_install do |installer|
      installer.pods_project.targets.each do |target|
          target.build_configurations.each do |config|
          if low_version_target_names.include?(target.name)
              config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
          end
          end
      end
      end
      ```

    For more information, see [Apple's privacy manifest documentation](https://developer.apple.com/documentation/).

    
  
      
  
      
  
