- Documentation
- RoomKit
- Getting started
- Integration
Integrate the RoomKit SDK
Prerequisites
Make sure your development environment meets the following requirements:
- Xcode 6.0 or later.
- An iOS device running iOS 9.0 or later.
- The iOS device is connected to the Internet.
Create a project
Launch Xcode, and click Create a new Xcode project in the Welcome to Xcode window. Alternatively, choose File > New > Project.
In the sheet that appears, select the iOS platform, then select App under Application.
In the sheet that appears, fill in the text fields and choose options from the pop-up menus to configure your project, then click Next.
You must provide a Product Name and Organization Identifier because they are used to create the Bundle Identifier that identifies your app throughout the system.
Choose a location to save your project, then click Create.
Import the SDK
- Download and unzip the latest version of the RoomKit SDK. For detailed download instructions, see RoomKit SDK downloads.
The SDK package you download from ZEGO's website contains the following two folders:
-
iphoneos
: the.framework
files in this folder should be used to build your project for real iOS devices only, which you should use for preparing your app for distribution. iphonos_simulator
: the.framework
files in this folder can be used to build your project for real iOS devices and iOS simulators. If you use the.framework
files in this folder for testing on iOS simulators, you must use the ones in theiphoneos
folder when you prepare your app for distribution; otherwise, your app may get rejected by Apple.
Please choose the set of .framework
files that fit your development needs.
Copy the
.framework
files from the folderiphoneos
oriphonos_simulator
(as explained above ) into your project directory.Copy the file
ZegoRoomKitResources.bundle
into your project directory.In Xcode, select your app target, click General, then under Frameworks, Libraries, and Embedded Content, click the Add button (+) below the table to add the
.framework
files you copied in the previous step.
In Xcode, select your app target, click Build Phases, then under Copy Bundle Resources, click the Add button (+) below the table to add the
ZegoRoomKitResources.bundle
file.
Configure the SDK
In Xcode, select your app target, click General, then under Frameworks, Libraries, and Embedded Content, set Embed to
Embed & Sign
for the added.framework
files.In Xcode, select the RoomKit screen sharing extension target, click General, then under Framework and Libraries, set Embed to
Do Not Embed
for the.framework
files as demonstrated below.
Add app permissions
Add app permissions as required.
In Xcode, select your app target.
Click Info, then under Custom iOS Target Properties, click the Add button (+) to add the permissions required for accessing the camera, microphone, and photos.
Privacy - Camera Usage Description
Privacy - Microphone Usage Description
Privacy - Photo Library Usage Description
Add Cocoapods libraries
The Cocoapods libraries listed below are also required. If you already imported some of them, you don't need to repeat them here.
Set all the imported third-party libraries as dynamic libraries:
use_frameworks!
.If your project has imported YYKit's other libraries (e.g., YYModel, YYCache), remove those libraries and only use the YYKit as shown below.
platform :ios, '9.0'
use_frameworks!
target 'ZegoRoomkitDemo' do
pod 'Masonry', '1.1.0'
pod 'YYKit', '1.0.9'
pod 'LEEAlert', '1.4.2'
pod 'MBProgressHUD', '1.2.0'
pod 'ReactiveObjC', '3.1.1'
pod 'SSZipArchive', '2.2.2'
pod 'TXIMSDK_Smart_iOS', '5.1.138'
end
Other settings
Configure capabilities
App Groups
If you want to use the screen sharing feature, you need to add an App Group for the data sharing between the main process and the screen sharing extension.
In Xcode, select your app target, click Signing & Capabilities, then click + Capability.
In the Capabilities library that appears, double-click the App Groups capability.
In the Signing & Capabilities pane, click the Add button (+) under the App Groups section.
In the dialog that appears, enter an App Group Container ID in the text field.
Background Modes
Background modes allow your app to continue running in the background.
In Xcode, select your app target, click Signing & Capabilities, then click the + Capability button.
In the Capabilities library that appears, double-click the Background Modes capability.
In the Signing & Capabilities pane, check the checkbox of the item Audio, AirPlay, and Picture in Picture under the Background Modes section.
iCloud
Users may select files stored on their iCloud drive for sharing, so you need to add the iCloud capability to your app target.
In Xcode, select your app target, click Signing & Capabilities, then click + Capability.
In the Capabilities library that appears, double-click the iCloud capability.
In the Signing & Capabilities pane, check the checkboxes of the Key-value storage and iCloud Documents services under the iCloud section, then click the Add button (+) to add an iCloud Container.
Device Orientation
You will also need to set up the supported screen orientations. Not doing so may result in app crashes.
In Xcode, select your app target.
Click General, then under Deployment Info, check the checkboxes for Device Orientation options Portrait and Landscape Right.
Create the screen sharing extension
In Xcode, select File > New > Target, and select to create a Broadcast Upload Extension target.
Click Next, then in the window that appears, uncheck the option Include UI Extension.
Add the App Groups capability to the extension target. You must use the same App Group Container ID you used for the main app target.
Import the RoomKit SDK as described in Section 2 above.
Refer to RoomKit sample code for how to implement the screen sharing extension.
Common issues
- When archiving the app, the error
Failed to verify bitcode in xxx.framework/xxx
occurs.
This is because your Xcode version is too old. Upgrade it to the latest version if you could. If you have to use an old version of Xcode, you can do the follows to fix the issue:
In Xcode, select your app target, select the Build Settings pane, then set the option Enable Bitcode to
No
.Start a Terminal window, run
cd
to go to the directory where the filexxx.framework
is located, and run the following command to remove the bitcode from the SDK.
xcrun bitcode_strip .framework/xxx -r -o xxx.framework/xxx
- When running the app, the error
Building for iOS Simulator, but the linked and embedded framework xxx.framework was built for iOS + iOS Simulator.
occurs.
For Xcode 12.3 or later, using Frameworks built for iOS + iOS(Simulator) is not allowed. To fix the issue, you can select your app target, select the Build Settings pane, then set the option Validate Workspace to Yes
.