I'm using Parse to create my App. My app works fine till I used the didSelectRowAtIndexPath method, as soon as I used the method to pass the data to another view controller to show detailed information, and when i tapped the 'Load More' row, i get error:
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 13 beyond bounds [0 .. 12]'
I googled it and some say: 'The problem might be in your tableView:didSelectRowAtIndexPath: method. This is called when any of your rows is tapped - including the loadMore cell. You might want to check if the cell that is being tapped is the Load More cell, and in that case return (and let the call to super handle loading more data).'
It's fairly reasonable to me, but this guy didn't give a solution and it was the answer 2 years ago, and I'm now using Swift.
So here's my code and anyone who can help me? Thanks.
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
var targetObject = objectAtIndexPath(indexPath)!
gameIdSelected = targetObject["GameId"] as! String
performSegueWithIdentifier("segue", sender: self)
}