我試圖將我的代碼從swift 2版本遷移到swift 3版本。 我無法遷移下面的代碼部分,我沒有找到任何解決方案。 我該怎麼辦?Alamofire類型'ParameterEncoding'沒有成員'URL'Swift 3
// MARK:URLRequestConvertible
public var URLRequest: NSMutableURLRequest {
let urlComponent = NSURLComponents(string: Router.baseURL)!
urlComponent.path = Router.basePath.stringByAppendingString(path)
let mutableURLRequest = NSMutableURLRequest(URL: urlComponent.URL!)
mutableURLRequest.HTTPMethod = method.rawValue
var parameters: [String: AnyObject] = Dictionary()
parameters["key"] = Router.key
parameters["hl"] = "en"
switch self {
case .getMostPopularVideos(let pageToken):
parameters["part"] = "snippet,contentDetails,statistics"
parameters["chart"] = "mostPopular"
parameters["videoCategoryId"] = TubeTrends.Settings.topTrendsCat
if let pageToken = pageToken {
parameters["pageToken"] = pageToken
}
return Alamofire.ParameterEncoding.URL.encode(mutableURLRequest, parameters: parameters).0 //This part Giving Error like Alamofire Type 'ParameterEncoding' has no member 'URL'
// default:
// return mutableURLRequest
}
}
}
我假設你不僅更新到斯威夫特3,而且還採用了最新版的Alamofire的? – Rob
是的你是正確的 – Jessica