Thread 1:EXC_BAD_INSTRUCTION error when calling "addObjectsFromArray"method for NSMutableArray <p>I have created a program where it calculates the borders of certain countries based on a Custom Object being inputed into a function. This function returns an array of custom objects. I keep getting this error when trying to add this array to a NSMutableArray. The error is called "Thread 1: EXC_BAD_INSTRUCTION(code=EXC_1386_INVOP, subcode=0x0)".</p> <p>Here is my adding code: </p> <pre><code>@IBOutlet var Label: UILabel! @IBOutlet var imageView: UIImageView! override func viewDidLoad() { //Afganistan Afghanistan.name = "Afghanistan" Afghanistan.borders.addObjectsFromArray(relate(Afghanistan)) Label.text = String((Afghanistan.borders[0] as! develop).name) } </code></pre> <p>Here is the relate method along with the group dictionary:</p> <pre><code>func relate(X : develop) -&gt; Array&lt;develop&gt;{ var A : [develop] = [] for (_, value) in groups { for y in value { if y.name == X.name { for i in value { if i.name != X.name { A.append(i) } } } } } return A } //Groups var groups = [ "one": [Afghanistan] ] </code></pre> <p>Here is the class of develop: </p> <pre><code> class develop : NSObject, NSCoding { //Shared var power : Int! var name : String! var image : UIImage! var flag : UIImage! var militaryName : String! //Military var experience : Int! var OATC : Int! var navy : Int! var airforce : Int! var artillery : Int! //Geography var borders : NSMutableArray! var cities : NSMutableArray! //Biomes var biom : NSMutableArray! var continent : String! var NSEW : String! //Encoding Section required convenience init(coder decoder: NSCoder) { self.init() //shared self.power = decoder.decodeObjectForKey("power") as! Int self.name = decoder.decodeObjectForKey("name") as! String self.image = decoder.decodeObjectForKey("image") as! UIImage self.flag = decoder.decodeObjectForKey("flag") as! UIImage self.militaryName = decoder.decodeObjectForKey("militaryName") as! String //Military self.experience = decoder.decodeObjectForKey("experience") as! Int self.OATC = decoder.decodeObjectForKey("OATC") as! Int self.navy = decoder.decodeObjectForKey("navy") as! Int self.airforce = decoder.decodeObjectForKey("airforce") as! Int self.artillery = decoder.decodeObjectForKey("artillery") as! Int //Geography self.borders = decoder.decodeObjectForKey("borders") as! NSMutableArray self.cities = decoder.decodeObjectForKey("cities") as! NSMutableArray self.continent = decoder.decodeObjectForKey("continent") as! String self.NSEW = decoder.decodeObjectForKey("NSEW") as! String } convenience init( power: Int, name: String, image: UIImage, flag: UIImage, relations: NSMutableArray, mName: String, experience: Int, OATC: Int, navy: Int, airforce: Int, artillery: Int, borders: NSMutableArray, cities: NSMutableArray, biom: NSMutableArray, continent: String, NSEW: String ) { self.init() //shared self.power = power self.name = name self.image = image self.flag = flag self.militaryName = mName //military self.experience = experience self.OATC = OATC self.navy = navy self.airforce = airforce self.artillery = artillery //geography self.borders = borders self.cities = cities self.biom = biom self.continent = continent self.NSEW = NSEW } func encodeWithCoder(coder: NSCoder) { //Shared if let power = power { coder.encodeObject(power, forKey: "power") } if let name = name { coder.encodeObject(name, forKey: "name") } if let image = image { coder.encodeObject(image, forKey: "image") } if let flag = flag { coder.encodeObject(flag, forKey: "flag") } if let militaryName = militaryName { coder.encodeObject(militaryName, forKey: "militaryName") } //Military if let experience = experience { coder.encodeObject(experience, forKey: "experience") } if let OATC = OATC { coder.encodeObject(OATC, forKey: "OATC") } if let navy = navy { coder.encodeObject(navy, forKey: "navy") } if let airforce = airforce { coder.encodeObject(airforce, forKey: "airforce") } if let artillery = artillery { coder.encodeObject(artillery, forKey: "artillery") } //geography if let borders = borders { coder.encodeObject(borders, forKey: "borders") } if let cities = cities { coder.encodeObject(cities, forKey: "cities") } if let biom = biom { coder.encodeObject(biom, forKey: "biom") } if let continent = continent { coder.encodeObject(continent, forKey: "continent") } if let NSEW = NSEW { coder.encodeObject(NSEW, forKey: "NSEW") } } } </code></pre> <p>"Afghanistan" is a subclass of develop</p>