iOS RTC 3.6.2 Crash

,

崩溃提示如下:

Fatal error: unexpected enum case 'AgoraExperiencePoorReason(rawValue: 6)'
2022-03-09 18:13:27.350868+0800 SLL Streaming[698:101488] Fatal error: unexpected enum case 'AgoraExperiencePoorReason(rawValue: 6)'
(lldb) 

声网的官网好像没有6这个枚举值,你这边是自己传了一个6进去吗?Agora Objective-C API Reference for iOS/macOS - 互动直播 - 文档中心 - 声网Agora

func rtcEngine(_ engine: AgoraRtcEngineKit, remoteAudioStats stats: AgoraRtcRemoteAudioStats)

方法返回的 AgoraRtcRemoteAudioStats 里的 qualityChangedReason 参数格式化输出时抛出的异常。

  func remoteAudioStatsDescription(_ stats: AgoraRtcRemoteAudioStats) -> String {
    
    func experienceQualityDescription(_ experienceQuality: AgoraExperienceQuality) -> String {
      switch experienceQuality {
        case .good:
          return "good"
        case .bad:
          return "bad"
      }
    }
    
    func experiencePoorReasonDescription(_ experiencePoorReason: AgoraExperiencePoorReason) -> String {
      switch experiencePoorReason {
        case .experienceReasonNone:
          return "-"
        case .remoteNetworkPoor:
          return "remote network poor"
        case .localNetworkPoor:
          return "local network poor"
        case .wirelessSignalPoor:
          return "wireless signal poor"
        case .wifiBluetoothCoexist:
          return "wifi bluetooth coexist"
      }
    }
    
    let uid = stats.uid
    
    let networkTransportDelay = stats.networkTransportDelay
    let jitterBufferDelay = stats.jitterBufferDelay
    
    let totalFrozenTime = stats.totalFrozenTime
    let frozenRate = stats.frozenRate
    
    let qoeQualityDescription = AgoraExperienceQuality(rawValue: stats.qoeQuality).flatMap { experienceQualityDescription($0) } ?? "-"
    
    let qualityChangedReasonDescription = AgoraExperiencePoorReason(rawValue: stats.qualityChangedReason).flatMap { experiencePoorReasonDescription($0) } ?? "-"
    
    // Mean Opinion Score
    let mosValue = stats.mosValue
    
    let remoteAudioStatsDescription = """
    uid: \(uid)
    sender-receiver network delay: \(networkTransportDelay) ms
    receiver- jitter buffer network delay: \(jitterBufferDelay) ms
    remote audio total frozen time: \(totalFrozenTime) ms
    remote audio frozen rate: \(frozenRate) %
    QoE (Quality of Experience) of local receiving remote audio: \(qoeQualityDescription)
    reason for poor QoE (Quality of Experience) of local receiving remote audio: \(qualityChangedReasonDescription)
    MOS (Mean Opinion Score): \(mosValue)
    """
    
    return remoteAudioStatsDescription
  }