2
我遇到了Alamofire 4.0會話管理器的問題。我的代碼如下:爲什麼我不能啓動Alamofire 4會話管理器?
func configAlamoManager() {
let configuration = URLSessionConfiguration.default
configuration.timeoutIntervalForRequest = 20
if Features.JWT_AUTH {
let user = SessionManager.getCurrentUser()
if let jwtToken = user.jwtToken {
let bearer = "Bearer \(jwtToken)"
configuration.httpAdditionalHeaders = ["MyCompany-Authorization": bearer, "MyCompany-User-Agent": Config.MyCompanyUserAgentDataString]
} else {
configuration.httpAdditionalHeaders = ["MyCompany-User-Agent": Config.MyCompanyUserAgentDataString]
}
}
alamoManager = Alamofire.SessionManager(configuration: configuration)
}
對於我收到錯誤「無法與類型的參數列表(配置:URLSessionConfiguration)調用SessionManager」行alamoManager = Alamofire.SessionManager(configuration: configuration)
。這裏有什麼問題?我正在關注文檔:https://github.com/Alamofire/Alamofire#modifying-the-session-configuration
。我似乎以完全相同的方式初始化會話管理器。任何指針都會非常感謝!
你解決了你的問題嗎? –