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.
- 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.
- 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
- Install Xcode if you have not done so already.
Download the RoomKit sample code and the RoomKit SDK.
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.
- Double-click the file ZegoRoomkitDemo.xcworkspace in the unzipped folder.
- 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:
- 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.
- 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.
- Click the Run button in the toolbar to build and run the sample code.