Your cellForRowAtIndexPath function tries to access an array object that it's beyond its bounds as the error says. I am guessing you have an array that is being updated with different objects and the size is not always the same or if it is the array is not always full of objects.
What I would suggest before doing something like this:
cell.myCellTitle.text = [yourArrayVariable objectAtIndex:indexPath.row];
to accessing your data, check first the count of the array is greater than your indexPath.row that cellForRowAtIndexPath is trying to call.
if (yourArrayVariable.count > indexPath.row) {
cell.myCellTitle.text = [yourArrayVariable objectAtIndex:indexPath.row]
}
This way whenever you try to reload your tableView you will be sure at least the function won't go beyond the NSArray bounds.
And one more thing, you should be careful about when and where you are trying to define your array and how you are initializing it. If you reload the tableView every time that you hit refresh, then you are probably assigning some new data to the array and you should consider reloading after you are properly initialized the array with your data.
Perhaps some snippets would help to see what you do in viewDidLoad, your refresh action, and cellForRowAtIndexPath delegate. It will also help to see the nature of your app and what you are trying to do in that UITableView controller. Things like getting the data from remote server and using dispatch_queue_t and call your reload from dispatch_async(dispatch_get_main_queue().
Hit me in comment if you need more details and I will update this answer as you develop your question.
Have happy coding:)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…