JoinChannel在调用Agora中的额外参数'byToken'

时间:2019-11-27 16:24:14

标签: swift agora.io

我使用cpp生成了令牌,并随后使用其示例代码进行了快速处理。但是它显示了一个错误-调用中有额外的参数“ byToken”。当我删除byToken时,该错误在调用中成为Extra参数'uid'。我该如何解决该错误?

`func joinChannel() {
        // Set audio route to speaker
        agoraKit.setDefaultAudioRouteToSpeakerphone(true)

        // 1. Users can only see each other after they join the
        // same channel successfully using the same app id.
        // 2. One token is only valid for the channel name that
        // you use to generate this token.

        let uid1: String =  (Auth.auth().currentUser?.uid)!

        agoraKit.joinChannel(byToken: Token, channelId: "channelroom1", info: nil, uid:uid1) { [unowned self] (channel, uid, elapsed) -> Void in
            // Did join channel "demoChannel1"
            self.isLocalVideoRender = true
//            self.logVC?.log(type: .info, content: "did join channel")
        }

        isStartCalling = true
        UIApplication.shared.isIdleTimerDisabled = true
    }`

1 个答案:

答案 0 :(得分:0)

出现此错误是因为 uid 变量的数据类型为 UInt
以下转换将起作用。

//Mark that I have changed here:UInt(uid)
    mRtcEngine.joinChannel(byToken: token, channelId: channelName, info: extraInfo , uid: UInt(uid)) { (sid, uid, elapsed) in
          self.mRtcEngine.setEnableSpeakerphone(true)
          UIApplication.shared.isIdleTimerDisabled = true
        }