File Sharing
  • iOS : Objective-C
  • Android
  • macOS
  • Windows
  • Web
  • Electron
  • Overview
  • SDK Downloads
  • Demo APP
  • Sample Codes
  • Access Guide
  • Quick Starts
  • Scene Practices
  • Advanced Features
  • Error Codes
  • Server API
  • API Documents
  • FAQ
Sample code
GitHub
Note
  • The sample code package is only for demonstrating the features of collaborative whiteboard and file sharing products. It can be used as a reference to assist with your development. However, the codes provided in this package haven't been rigorously tested. If you plan to use them in a production environment, make sure you conduct sufficient testing before release to avoid any potential issues that may cause losses.
  • ZEGO no longer classifies environments into production environments and testing environments. If you create your project in ZEGO Admin Console on/before 2021-11-16, refer to the Testing environment deprecation to upgrade the SDK and adjust related codes.

Run the sample code

1 Set up the development environment

Make sure your development environment meets the following requirements:

  • Xcode 7.0 or later.
  • An iOS device or simulator that is running iOS 9.0 or later (iPad devices or simulators cannot run all functions correctly).
  • The iOS device is connected to the internet.

2 Prerequisites

Before you begin, make sure you complete the following steps:

  1. Create a project in the ZEGO Admin Console and get the AppID and AppSign of your project. For details, see ZEGO Admin Console - Project management.

3 Run the sample code

  1. If you haven't done so already, install Xcode from the AppStore.

  2. Launch Xcode, and open the file ZegoWhiteboardExample.xcworkspace.

    a. In Xcode, select the menu File > Open.

    /Pics/iOS/GoClass/xcode-open-file.png

    b. Select the file ZegoWhiteboardExample.xcworkspace in the unzipped sample code folder, and click Open.

    /Pics/iOS/WhiteboardExample/whiteboard_demo_dir_workspace.png

  3. Add your Apple developer account.

    a. Select the menu Xcode > Preferences.

    b. Click Accounts.

    c. In the lower-left corner, click the Add button (+).

    d. In the sheet that appears, choose Apple ID, then click Continue.

    /Pics/iOS/GoClass/xcode-account.png

    e. In the next sheet, enter your Apple ID, click Next, enter your password, then click Next.

    /Pics/iOS/GoClass/xcode-login-apple-id.png

  4. Change the bundle ID and signing certificate.

    a. In Xcode, select the ZegoWhiteboardExample project in the project navigator.

    /Pics/iOS/WhiteboardExample/whiteboard_demo_target.png

    b. Click Signing & Capabilities. Under Signing, choose your team from the Team pop-up menu, and change Bundle Identifier to your own setting.

    /Pics/iOS/WhiteboardExample/whiteboard_team_cert.png

  5. Modify the ZegoLocalEnvManager.m file to specify your AppID and AppSign, which are required for initializing the SDK.

  1. Connect the iOS device to your development computer.

  2. In Xcode, click Any iOS Device, and select the iOS device you just connected.

    /Pics/iOS/WhiteboardExample/whiteboard_demo_generic_arch.png
    /Pics/iOS/WhiteboardExample/whiteboard_demo_run_device.png

  3. Switch to the folder where the file Podfile is located, run the command pod install in the Terminal, and then wait for the command to complete.

  4. Click the Build button to compile and run the sample code.

    /Pics/iOS/WhiteboardExample/whiteboard_demo_run_btn.png