Search code examples
iosswiftxcodelive-streamingagora.io

No such module 'AgoraRtcKit' Xcode Swift error


I am trying to integrate live video streaming into my app through a 3rd party named as Agora. I am facing some errors as No such module 'AgoraRtcKit'. I have already imported the library SDK from their website (also attached the screenshot for the same).

Code:

 //
//  RoleViewController.swift
//  OpenLive
//
//  Created by CavanSu on 2019/8/28.
//  Copyright © 2019 Agora. All rights reserved.
//

import UIKit
import AgoraRtcKit. // This is the module which is not getting imported 

protocol RoleVCDelegate: NSObjectProtocol {
    func roleVC(_ vc: RoleViewController, didSelect role: AgoraClientRole)
}

class RoleViewController: UIViewController {

    weak var delegate: RoleVCDelegate?
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override var preferredStatusBarStyle: UIStatusBarStyle {
        return .lightContent
    }
    
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        guard let segueId = segue.identifier,
            segueId.count > 0 else {
            return
        }
        
        switch segueId {
        case "roleToLive":
            guard let mainVC = navigationController?.viewControllers.first as? MainViewController,
                let liveVC = segue.destination as? LiveRoomViewController else {
                return
            }
            
            liveVC.dataSource = mainVC
        default:
            break
        }
    }
    
    func selectedRoleToLive(role: AgoraClientRole) {
        delegate?.roleVC(self, didSelect: role)
        performSegue(withIdentifier: "roleToLive", sender: nil)
    }
    
    @IBAction func doBroadcasterTap(_ sender: UITapGestureRecognizer) {
        selectedRoleToLive(role: .broadcaster)
    }
    
    @IBAction func doAudienceTap(_ sender: UITapGestureRecognizer) {
        selectedRoleToLive(role: .audience)
    }
}


Images for reference:

File system with SDK framework

Framework which I had added


Solution

  • This is the sample project that OP is trying to get running: Basic-Video-Broadcasting/OpenLive-iOS

    To get it to build and run, download the project and the Video SDK from here. Open the project and remove AgoraRtcKit.framework from the Frameworks, Libraries, and Embedded Content list. Next drag the libs folder from the downloaded SDK into the project directory. Navigate to the libs folder and drag AgoraRtcKit.framework back into the Frameworks, Libraries, and Embedded Content.