Nsmutablearray Add data add failed print null-no initialization/initialization write error

Source: Internet
Author: User

I made a small mistake today. Add the parsed model to the mutable array and add No. In the next breakpoint test, the Forin print group has been null. It took me two hours to figure it out.

The lazy loading method was named incorrectly in the process of checking the code. Causes no initialization. Record your own small error here.

1/** Data Array *  /2 3 @property (nonatomic, Strong) Nsmutablearray *statuses; 4  5  6  7//change before 8 9  -(NSM Utablearray *) status{10 if (!  _statues) {_statuses = }15 return}19 20//Change after-(Nsmutablearray *) statuses{22 if (!
          
           _statues) {_statuses =
            }28 return _statuses;30
          

Although very simple, but the mistakes made. Sometimes it is so headache, must be careful!

Nsmutablearray Add data add failed print null-no initialization/initialization write error

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.