This topic describes how to integrate Push SDK for iOS.

Environment requirements

Item Requirement
iOS version iOS 8.0 or later
Phone model iPhone 5S or later
CPU architecture ARM64 or ARMv7
Integration tool Xcode 8.0 or later
bitcode Disabled

Download the SDK package

Note Each version of Push SDK for iOS contains two editions. The edition that applies only to ARM architectures supports debugging on physical devices. The edition that applies to both ARM and simulator architectures supports debugging on physical devices and simulators. You must use the edition that applies only to ARM architectures to publish your project online.
Download the SDK package of the required version by using the download link provided in the SDK download and release notes topic. Push SDK for iOS is contained in the AlivcLivePusher folder, as shown in the following figure.SDK package
The following table describes the differences between the subfolders.
Subfolder Description
AlivcLivePusherSDK/arm The edition that applies only to ARM architectures.
AlivcLivePusherSDK/arm&simulator The edition that applies to both ARM and simulator architectures.

Integrate Push SDK for iOS

After you integrate Push SDK for iOS in manual or pod mode, you must configure permissions to use features and access resources, disable bitcode, and use Push SDK for iOS.

  1. Integrate Push SDK for iOS in manual or pod mode. If you use manual mode, follow Step 2. If you use pod mode, follow Step 3.
  2. Integrate Push SDK for iOS in manual mode:
    1. Create a demo project named DemoPush in Xcode.
    2. Add the following files to the demo project in Xcode.
      • AlivcLibRtmp.framework
      • AlivcLivePusher.framework
      • RtsSDK.framework
      To use the retouching and sticker effects, you must also add the following files:
      • queen.framework
      • openvc2.framework
      • Face3D.framework
      • FaceDetection.framework
      • MNN.framework
      • pixelai.framework
      If you use an SDK edition that requires ApsaraVideo Player SDK, you must also add the following files:
      • AliyunPlayer.framework
      • artcSource.framework
      • alivcffmpeg.frameworkApsaraVideo Player SDK
    3. Select Copy items if needed and click Finish. Check box
    4. After you import Push SDK for iOS, add the SDK dependencies to the Embedded Binaries section of the General tab in Xcode. SDK dependencies
  3. Integrate Push SDK for iOS in pod mode:
    1. Open Terminal and run the following command to install CocoaPods. Note: Set up a Ruby environment on macOS in advance.
      sudo gem install cocoapods
    2. In Terminal, run the following command to create a Podfile file in the project path:
      pod init
    3. Edit the Podfile file to add Push SDK for iOS as a dependency. To achieve live stream playback, you can add ApsaraVideo Player SDK as a dependency.
      # Integrate Push SDK for iOS.
      pod 'AlivcLivePusher', '~> 4.2.1'
      pod 'RtsSDK', '~> 1.8'
      # Integrate ApsaraVideo Player SDK.
      pod 'AliPlayerSDK_iOS', '~> 5.4.2'
      pod 'AliPlayerSDK_iOS_ARTC', '~> 5.4.2'
    4. In Terminal, run the following command. After the preceding commands are executed, the project file with the .xcworkspace suffix is generated. Double click the project file to update and install Push SDK for iOS.
      pod install
      or
      pod update
  4. Configure the permissions to use features and access resources.
    Note To use the recording feature and the camera, you must add the related permission configurations to the Info.plist file.
    Add the following configurations for permissions on the microphone and camera in the Info.plist file: Privacy - Camera Usage Description and Privacy - Microphone Usage Description. Camera and microphone permissionsIf you want to continue stream ingest when the mobile app is switched to the background, you must enable audio recording in the background. Audio recording in the background
  5. Disable bitcode.
    Push SDK for iOS does not support bitcode. Therefore, you must set the Enable Bitcode parameter to No for the demo project. Disable bitcode
  6. Use the SDK.