RoomKit
  • Platform
  • Framework / Engine
  • iOS
  • Android
  • macOS
  • Windows
  • Linux
  • Web
  • WeChat Mini Program
Sample code
Download
Note

1 Run the RoomKit sample code

1.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 running iOS 9.0 or later (we recommend you use a real device).
  • The iOS device is connected to the internet.
  • CocoaPods installed.

1.2 Prerequisites

  1. Contact ZEGO Sales to enable the RoomKit service and obtain your RoomKit Admin Console login account and password.
  2. Log in to RoomKit Admin Console to obtain the SecretID, SecretSign, and ProductID, which are required for initializing the RoomKit SDK.

While the sample code shows that it is possible to get the SDK access token required for the subsequent login process by directly specifying the SecretID and SecretSign in the client code, don't use this approach when you develop your own app. To ensure system security, get the SDK access token by posting a Get SDK access token request from your application server to the RoomKit server.

1.3 Run the sample code

  1. Download the RoomKit sample code.

  2. Open Terminal, go to the directory where the Podfile is located, and run the command pod repo update to update the local dependency library index. This step may take a while ( about 3 to 20 minutes) to complete, depending on your network condition,

  3. Run the command pod install and wait for all the dependent libraries to be downloaded (the size of RoomKit related SDKs is about 300 MB).

  4. Double-click the file ZegoRoomkitDemo.xcworkspace in the unzipped folder.

    workspace_position

  5. Change the bundle identifier and signing certificate.

    a. In the Xcode project navigator, click the project ZegoRoomkitDemo.

    choose_project

    b. Select the target ZegoRoomkitDemo, click Signing & Capabilities, then under Signing, choose your team from the Team pop-up menu, and change Bundle Identifier and App Groups to your own value. Repeat the same steps for the extension target ZegoRoomkitDemoScreenShare.

    For the target ZegoRoomkitDemo, change the settings as indicated below:

    signing_1

    For the extension target ZegoRoomkitDemoScreenShare, change the settings as indicated below:

    signing_2

  6. Modify the source file ZegoAuthConstants.h.

    Specify the values of the parameters that are required for initializing the RoomKit SDK, including kZegoSecretID, kZegoSecretSign, and kProductID. You must use the values you obtained according to the procedure mentioned in the Prerequisites section above. Otherwise, the sample code will not run correctly.

    auth_en

  7. Connect the iOS device to your development computer. Then, from the scheme menu in the Xcode toolbar, choose the connected iOS device (or an iOS simulator) as the run destination.

    choose_device

  8. Click the Run button in the toolbar to build and run the sample code.

    run