XCode6 reports array out-of-bounds errors, and xcode6 reports array out-of-bounds errors.
Today, I encountered a very strange problem. After debugging for a long time:
Error: "index 0 beyond bounds for empty array", which means that the data source array is nil. Therefore, if you call the direct value, an error is reported.
I will describe my scenarios:
1. create a cell in UITaleView. The data source dataArray exists and the number is 10. Then I am [dataArray objectatindexpath. row] is used as the cell data. Of course, the dataArray is returned in the numberOfRowsAtIndexPath. count.
2. everything seems so impeccable, just as I move tableView, every time I go to indexPath. row = 7 will crash, and then the above error is reported: empty array, but I repeatedly debug and found that the array is not empty, and in indexPath. when row = 7, crash is required.
3. I was puzzled. I asked google for help. I found someone in stackoverflow and said, "restart your xcode". Then I did it. The problem is solved! Don't crash it! I'm dizzy!
Summary: this may be just a bug in xcode. If you know the specific cause, please let us know.