无法将类型为“Mappable”的类分配给AlamoFire响应

时间:2016-06-17 13:52:03

标签: ios swift class alamofire objectmapper

所以我正在使用Alamofire进行提取,并且根据索引(请参阅switch currentIndex)我想获得一个不同的URL(有效)和一个Class(不起作用)。

类文件夹和文章都声明如下:class Folders : Mappableclass Article : Mappable

    var responseMapping:Mappable?
    var URL:String = ""
    switch currentIndex {
    case 0:
        URL = "searchFolderURL".localized + searchString
        responseMapping = Folders
    case 1:
        URL = "searchArticleURL".localized + searchString
        responseMapping = Article
    default:
        print("Something went horribly wrong")
        guard URL != "" else {
            return
        }
    }
    print(URL)

    Alamofire.request(.GET, URL).responseObject { (response: Response<responseMapping, NSError>) in
        if response.result.isSuccess {

当我尝试以下代码时,它会返回下一个错误:'responseMapping' is not a typeCannot assign value of type 'Article.Type' to type 'Mappable?'

我在这里缺少什么?

0 个答案:

没有答案