Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXC_BAD_INSTRUCTION #51

Closed
yamila-fraiman opened this issue Nov 7, 2015 · 0 comments
Closed

EXC_BAD_INSTRUCTION #51

yamila-fraiman opened this issue Nov 7, 2015 · 0 comments

Comments

@yamila-fraiman
Copy link

I am getting data from my server. The response is:
{"languages":[{"language":"en","disabled":false}]}

When I do the request the code suddenly throws EXC_BAD_INSTRUCTION and it gets stuck in the error. If I remove inheritance Object from Language.swift it works ok

LanguageResponse.swift

import ObjectMapper

class LanguageResponse: Mappable {

    var languages: [Language]?

    required init?(_ map: Map){
    }

    override func mapping(map: Map) {
        super.mapping(map)
        languages <- map["languages"]
    }

}

Language.swift

import UIKit
import RealmSwift
import ObjectMapper

class Language: Object, Mappable {

    dynamic var language: String = ""

    override static func primaryKey() -> String? {
        return "language"
    }

    required convenience init?(_ map: Map) {
        self.init()
    }

    func mapping(map: Map) {
        language <- map["language"]
    }

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants