title: Swift - error when calling random value in array
body: <p>I'm trying to call a random value within my array into my query where it says "<strong>objectId</strong>" but I'm getting an error <code>"EXC_BAD_INSTRUCTION"</code> where it says <code>let votes = voteCount1["votes"] as Int</code>.  It is below my <code>IBAction</code> with the function <code>addVote1</code>. </p>
  
  <p>Where am I going wrong? I'm trying to retrieve the values for each variable that are all within a certain row in my Parse data controller (each one with a certain objectId) and send a vote to the corresponding variable within that row but I'm getting an error.  The only way for me not to get the error is if I specifically define the objectId in place of where it says "<strong>objectId</strong>" in <code>query.getObjectInBackgroundWithId("objectId")</code>.  Where could I be going wrong?</p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
      // Do any additional setup after loading the view, typically from a nib.
  
      var voteCount1 = PFObject(className: "VoteCount")
      voteCount1["choices"] = 2
      voteCount1["votes"] = Int()
      voteCount1["votes2"] = Int()
      voteCount1["optionName"] = String()
      voteCount1["optionName2"] = String()
  
      var voteCount2 = PFObject(className: "VoteCount2")
      voteCount2["choices"] = 3
      voteCount2["votes"] = Int()
      voteCount2["votes2"] = Int()
      voteCount2["votes3"] = Int()
      voteCount2["optionName"] = String()
      voteCount2["optionName2"] = String()
      voteCount2["optionName3"] = String()
  
      var voteCount3 = PFObject(className: "VoteCount3")
      voteCount3["choices"] = 4
      voteCount3["votes"] = Int()
      voteCount3["votes2"] = Int()
      voteCount3["votes3"] = Int()
      voteCount3["votes4"] = Int()
      voteCount3["optionName"] = String()
      voteCount3["optionName2"] = String()
      voteCount3["optionName3"] = String()
      voteCount3["optionName4"] = String()
  
      let array = ["BiEM17uUYT", "TtKGatVCi9"]
      let randomIndex = Int(arc4random_uniform(UInt32(array.count)))
      let objectId = array[randomIndex]
  
  
  
  
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  @IBOutlet weak var pollResults1: UILabel!
  
  @IBAction func addVote1(sender: AnyObject) {
      var query = PFQuery(className: "VoteCount")
      query.getObjectInBackgroundWithId("objectId") {
          (voteCount1: PFObject!, error: NSError!) -&gt; Void in
          if error != nil {
              NSLog("%@", error)
          } else {
              voteCount1.incrementKey("votes")
              voteCount1.saveInBackgroundWithTarget(nil, selector: nil)
          }
          let votes = voteCount1["votes"] as Int
          let votes2 = voteCount1["votes2"] as Int
          self.pollResults1.text = "\(votes)"
          }
      }
  }
  </code></pre>