小编Aak*_*ash的帖子

ObjectMapper无法序列化响应

我正在使用AlamofireObjectMapper,每当响应包含任何空值时,它都会出错,

"FAILURE:Error Domain = com.alamofireobjectmapper.error Code = 2"ObjectMapper无法序列化响应."UserInfo = {NSLocalizedFailureReason = ObjectMapper无法序列化响应.}"

这就是我的要求

let URL = "https://demo6336282.mockable.io/myapi"
        Alamofire.request(URL).validate().responseObject { (response: DataResponse<WeatherResponse>) in

            let weatherResponse = response.result.value
            print(weatherResponse?.location)

            if let threeDayForecast = weatherResponse?.threeDayForecast {
                for forecast in threeDayForecast {
                    print(forecast.day)
                    print(forecast.temperature)           
                }
            }
        }
Run Code Online (Sandbox Code Playgroud)

这是我的DataModel类

import Foundation
import ObjectMapper
import AlamofireObjectMapper

class WeatherResponse: Mappable {
    var location: String? = ""
    var threeDayForecast: [Forecast]? = []

    required init?(map: Map){

    }

    func mapping(map: Map) {
        location <- map["location"]
        threeDayForecast <- map["three_day_forecast"] …
Run Code Online (Sandbox Code Playgroud)

ios swift alamofire objectmapper

7
推荐指数
1
解决办法
4661
查看次数

如何在使用WebRTC和CallKit时配置音频会话?

在使用WebRTC和CallKit时,我对如何配置音频会话感到很困惑.我提到了Speakerbox App,但是有一个单独的AudioController用于配置音频会话.当我实施这个时,我听到了自己的声音.我不知何故认为我需要使用RTCAudioSession配置音频会话,而不是使用Speakerbox App中使用的AudioController.

如果我是正确的请告诉我如何使用RTCAudioSession配置音频会话,如果没有,那么我如何解决我自己的声音被听到的问题.

我已经浪费了很多时间,没有在任何地方如何做到这一点,而且我也找不到WebRTC和CallKit的任何教程.

audio ios webrtc swift callkit

5
推荐指数
0
解决办法
571
查看次数

标签 统计

ios ×2

swift ×2

alamofire ×1

audio ×1

callkit ×1

objectmapper ×1

webrtc ×1