XCode6 reports array out-of-bounds errors, and xcode6 reports array out-of-bounds errors.

Source: Internet
Author: User

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.

Related Article

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.