Today encountered a very wonderful problem, commissioning a half-day:
Error: "index 0 beyond bounds for empty array", meaning that the data source array is nil, so you call directly to take the value of the error.
I describe my scene:
1. Create cell in Uitaleview, data source DataArray is present and quantity is 10, then I am [DataArray Objectatindexindexpath.row] to take value as cell data, Of course Numberofrowsatindexpath inside is back to Dataarray.count.
2. Everything seems so invulnerable, just as I paddled tableview, every time to Indexpath.row = 7 time will be crash, and then reported the above error: empty array, but I repeatedly debug found that the array is not empty, and in the indexpath.row= When you are 7, you will crash.
3. Think of the solution, to help Google, found in StackOverflow someone said: "Restart your Xcode", and then did, the problem solved! Believe it, you won't crash! I'm dizzy!
Summary: Perhaps this is just a bug of Xcode, if someone knows the specific reason, hope to inform.
The problem of cross-border error in XCode6 Group