The problem of cross-border error in XCode6 Group

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.