This topic describes how to integrate Push SDK for iOS.
Environment requirements
Item | Requirement |
OS version | iOS 8.0 or later |
Phone model | iPhone 7 or later |
CPU architecture | ARM64 or ARMv7 |
Integration tool | Xcode 8.0 or later |
bitcode | Disabled |
Download the SDK package
Each release of Push SDK for iOS is compiled in two versions: an ARM version that supports debugging only on physical devices and an ARM and simulator version that supports debugging on physical devices and simulators. You must use the ARM version in production environments.
Download the SDK package from the link provided in SDK download and release notes. The basic edition of Push SDK for iOS is stored in the AlivcLivePusher folder, as shown in the following figure.
The following table describes the subfolders.
Subfolder | Description |
AlivcLivePusherSDK/arm | The ARM version of the basic edition of Push SDK for iOS. |
AlivcLivePusherSDK/arm&simulator | The ARM and simulator version of the basic edition of Push SDK for iOS. |
The interactive edition of Push SDK for iOS is stored in the AlivcLivePusher_InteractiveSDK folder, as shown in the following figure.
The following table describes the subfolders.
Subfolder | Description |
AlivcLivePusher_InteractiveSDK/arm | The ARM version of the interactive edition of Push SDK for iOS. |
AlivcLivePusher_InteractiveSDK/arm&simulator | The ARM and simulator version of the interactive edition of Push SDK for iOS. |
Integrate Push SDK for iOS
You can integrate Push SDK for iOS manually or by using CocoaPods. After integration, you must configure microphone and camera permissions, disable Bitcode, and view the SDK usage notes.
Select an integration method and perform the corresponding steps to integrate Push SDK for iOS.
Manually integrate Push SDK for iOS
Create an Xcode project for your application. In this example, a project named DemoPush is created.
Add the following files to the project:
AlivcLibReplayKitExt.framework
AlivcLivePusher.framework
If your application requires retouching effects and stickers, drag the following files to Xcode:
queen.framework
openvc2.framework
MNN.framework
AliyunQueenUIKit.framework
If you want to integrate ApsaraVideo Player SDK for stream playback, drag the following files to Xcode:
RtsSDK.framework
AliyunPlayer.framework
artcSource.framework
alivcffmpeg.framework
Select Copy items if needed and click Finish.
After you add the SDK files, choose to add SDK dependencies.
Integrate the SDK by using CocoaPods
Open Terminal and run the following command to install CocoaPods:
ImportantSet up a Ruby environment on macOS before you install CocoaPods.
sudo gem install cocoapods
In Terminal, run the following command to create a Podfile file in the project path:
pod init
Edit the Podfile file to add Push SDK for iOS as a dependency. If you want to use the playback feature, add ApsaraVideo Player SDK as a dependency.
Push SDK for iOS (basic edition):
# Integrate the basic edition of Push SDK for iOS. pod 'AlivcLivePusher', '~> 6.17.0'
Push SDK for iOS (interactive edition):
# Integrate the interactive edition of Push SDK for iOS. pod 'AlivcLivePusher_Interactive', '~> 6.17.0'
Run the following command in Terminal. After you run the command, a project file whose name contains the .xcworkspace suffix is generated. Double-click the file to update or install Push SDK for iOS.
pod install
or
pod update
Configure the required permissions
NoteYou must configure camera and microphone permissions.
Select the Info.plist file in the left-side project navigator. In the editor area that appears, add the Privacy - Camera Usage Description and Privacy - Microphone Usage Description keys and specify values for the keys. If your application needs to continue stream ingest in the background, select Audio, AirPlay, and Picture in Picture in the Background Modes section, as shown in the following figure.
Disable Bitcode
The SDK does not support Bitcode. You must set Enable Bitcode to No, as shown in the following figure.
Configure a license
Push SDK 4.4.2 and later versions support all-in-one licenses. You must configure a license for the SDK. For more information, see Configure a license for iOS.
SDK usage notes
For information about API operations, see API references for Push SDK for iOS (basic edition) or API references for Push SDK for iOS (interactive edition). You can also view API documentation in the SDK package.
To view the sample code for API operations, see Use Push SDK for iOS.