• Platform
  • Framework / Engine
  • iOS
  • Android
  • macOS
  • Windows
  • Linux
  • Web
  • WeChat Mini Program
Sample Code

1 Run the RoomKit Sample Code

1.1 Prepare the Development Environment

Please ensure your development environment meets the following requirements:

  • Xcode 7.0 or higher.
  • An iOS device or simulator with iOS 9.0 (or higher) and audio/video capabilities (using a real device is recommended).
  • The iOS device is connected to the Internet.

1.2 Prerequisites

  1. Contact ZEGO technical support to get the information required for initializing the RoomKit SDK, including SecretID, SecretSign, Domain, ProductID_1v1, ProductID_smallRoom, ProductID_largeRoom, and others.

While the sample code shows that it is possible to get the SDK Token required for the subsequent login process by directly specifying the SecretID and SecretSign in the client code, it is not recommended to do so when you develop your own app.

To ensure data security, it is recommended to get the SDK Token by posting a Get SDK Token request from your application server to the ZegoRoomKit server.

  1. Create a user. You will need a userID to authenticate with the RoomKit server.
  • For testing purposes, you can create a user manually via the RoomKit Admin Console. We will provide you with the login details.

  • In production, your application server will need to request the RoomKit server to create a new user and pass the userID returned by the RoomKit server to your application client for authentication with the RoomKit server. Refer to RoomKit Server APIs for more details about user operations on the server side.

1.3 Run the Sample Code

  1. Install Xcode if you have not done so already.
  1. Download the RoomKit sample code and the RoomKit SDK.

  2. Unzip the RoomKit sample code and SDK package that you have downloaded, and then copy all the SDK and bundle files to the Lib folder according to the selected architecture.


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


  1. Modify the signing certificate and bundle identifier.

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


b. Select the target, click the Signing & Capabilities tab, and change the Team, Bundle Identifier, and App Groups to your own values. Repeat the same steps for the Extension target.

Select the target ZegoRoomkitDemo and change the settings as indicated below:


Select the extension target ZegoRoomkitDemoScreenShare, and change the settings as indicated below:


  1. Modify the source file ZegoAuthConstants.h.

a. Specify the values of the parameters that are required for initializing the RoomKit SDK, including kZegoSecretID, kZegoSecretSign, and others. Please use the values you obtained according to the procedure mentioned in the Prerequisites section above, otherwise the sample code will not run properly.

b. Change the values of kZegoRPAppGroup and kAppExtensionBundleID to the ones you used in step 3 above.


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


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