IOS workaround for array out of bounds

Source: Internet
Author: User

The so-called array is out of bounds, that is, if your subscript total is now 32, and then you execute a method in the next second to wake the assignment from 50 data Ah, filter and so on, and you at this time the number of 32 50 of the data has not been requested to often appear array out of the crash information is probably the case-[__nsarrayi Objectatindex:]: Index beyond bounds [0:9] ' Specific solution we usually choose to make the array as a judgment column such as return nil;

Although in most cases it is possible, but how much is not rigorous, if you set an event loop to execute the Nstimer and your data volume is very large the array number is always in the change column like a pin on a map you walk around and change. Then we need to do a method extension to Nsarray or nsmutablearray ourselves instead of [_datasourcearray ObjectAtIndex:indexPath.row].

Here's a way to look from a great god I tried, and it helped me!

Objectatindex replaced by this Objectatindexcheck

Everyone can try, always in progress to learn the logic of the Great God

IOS workaround for array out of bounds

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.